Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove questionable use of NumberUtils #9

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.sling.api.resource.Resource;

import javax.jcr.Node;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand All @@ -52,9 +53,11 @@
public class AddAllResourceContentPropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(CONTENT_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(CONTENT_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.sling.api.resource.Resource;

import javax.jcr.Node;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand All @@ -50,9 +51,11 @@
public class AddBasicResourcePropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(CONTENT_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(CONTENT_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.sling.api.resource.ResourceResolverFactory;

import javax.jcr.Node;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand All @@ -55,14 +56,16 @@
public class AddComponentPropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy = ReferencePolicy.STATIC)
private ResourceResolverFactory resourceResolverFactory;
private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(COMPONENT_CATEGORY));

private static final String CONFIG_SERVICE = "config-service";

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy = ReferencePolicy.STATIC)
private ResourceResolverFactory resourceResolverFactory;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(COMPONENT_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand All @@ -52,9 +53,11 @@
public class AddDesignPropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(DESIGN_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(DESIGN_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand All @@ -50,9 +51,11 @@
public class AddGlobalPropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(GLOBAL_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(GLOBAL_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

import javax.jcr.Node;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;

Expand All @@ -63,12 +64,14 @@
public class AddPagePropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(PAGE_CATEGORY));

@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY, policy = ReferencePolicy.STATIC)
protected AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(PAGE_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@

import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import static danta.Constants.DOT;
import static danta.Constants.HIGHEST_PRIORITY;
Expand All @@ -56,14 +63,16 @@
public class AddSlingModelsPropertiesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModel> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(SLING_MODELS_CATEGORY));

@Reference
private ModelFactory modelFactory;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(SLING_MODELS_CATEGORY);
return ANY_OF;
}

@Reference
private ModelFactory modelFactory = null;

@Override
public int priority() {
return HIGHEST_PRIORITY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.sling.api.SlingHttpServletRequest;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -80,9 +81,11 @@
public class AddStylingContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(STYLING_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(STYLING_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.sling.api.SlingHttpServletRequest;

import java.util.Collection;
import java.util.Collections;
import java.util.Set;

import static danta.Constants.COMPONENT_CATEGORY;
Expand Down Expand Up @@ -76,9 +77,11 @@
public class DeserializeJSONPropertyValuesContextProcessor
extends AbstractCheckComponentCategoryContextProcessor<TemplateContentModelImpl> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(COMPONENT_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(COMPONENT_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;

import java.util.Collections;
import java.util.Set;

import static danta.Constants.IMAGE_CATEGORY;
Expand All @@ -41,8 +42,10 @@ public abstract class AbstractImageContextProcessor<C extends ContentModel>
extends AbstractCheckComponentCategoryContextProcessor<C>
implements ImageContextProcessor<C> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(IMAGE_CATEGORY));

@Override
public Set<String> anyOf() {
return Sets.newHashSet(IMAGE_CATEGORY);
return ANY_OF;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;

Expand All @@ -54,12 +55,14 @@
public class AddMultipleTransformedImagePathsFromResourcesContextProcessor
extends AbstractImageContextProcessor<TemplateContentModel> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(MULTIPLE_IMAGE_RESOURCES_CATEGORY));

@Reference
AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(MULTIPLE_IMAGE_RESOURCES_CATEGORY);
return ANY_OF;
}

private final Predicate<Resource> IMAGE_RESOURCES_PREDICATE = new Predicate<Resource>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;

import java.util.Collections;
import java.util.Set;

import static danta.Constants.*;
Expand All @@ -45,12 +46,14 @@
public class AddTransformedImagePathContextProcessor
extends AbstractImageContextProcessor<TemplateContentModel> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(CONTENT_IMAGE_CATEGORY));

@Reference
AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(CONTENT_IMAGE_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;

import java.util.Collections;
import java.util.Set;

import static danta.Constants.*;
Expand All @@ -49,12 +50,14 @@
public class AddTransformedImagePathFromDesignContextProcessor
extends AbstractImageContextProcessor<TemplateContentModel> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(DESIGN_IMAGE_CATEGORY));

@Reference
private AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(DESIGN_IMAGE_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;

import java.util.Collections;
import java.util.Set;

import static danta.Constants.*;
Expand All @@ -48,15 +49,17 @@
public class AddTransformedImagePathFromGlobalContextProcessor
extends AbstractImageContextProcessor<TemplateContentModel> {

public static final String CONFIG_GLOBAL_IMAGE_KEY = CONFIG_PROPERTIES_KEY + DOT + "xk_globalImagePath";
private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(GLOBAL_IMAGE_CATEGORY));

private static final String CONFIG_GLOBAL_IMAGE_KEY = CONFIG_PROPERTIES_KEY + DOT + "xk_globalImagePath";
private static final String COMPONENT_GLOBAL_DIALOG_PATH = COMPONENT_PROPERTIES_KEY + DOT + GLOBAL_PATH_PROPERTY_KEY;

@Reference
AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(GLOBAL_IMAGE_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -54,12 +55,14 @@
public class AddTransformedImagePathsContextProcessor
extends AbstractImageContextProcessor<TemplateContentModel> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(IMAGES_BY_KEY_CATEGORY));

@Reference
AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(IMAGES_BY_KEY_CATEGORY);
return ANY_OF;
}

private final Predicate<Resource> IMAGE_RESOURCES_PREDICATE = new Predicate<Resource>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;

import static danta.Constants.*;
Expand All @@ -49,12 +50,14 @@
public class AddTransformedMultipleImagePathsContextProcessor
extends AbstractImageContextProcessor<TemplateContentModel> {

private static final Set<String> ANY_OF = Collections.unmodifiableSet(Sets.newHashSet(MULTIPLE_IMAGE_CATEGORY));

@Reference
AssetPathService assetPathService;

@Override
public Set<String> anyOf() {
return Sets.newHashSet(MULTIPLE_IMAGE_CATEGORY);
return ANY_OF;
}

@Override
Expand Down
Loading