Improved: Remove redundant specification of type arguments
(OFBIZ-10937) Since Java 1.7, when defining generic types it is unnecessary to redefine those types in the constructor when it is done in the declared type. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -61,7 +61,7 @@ public final class MiniLangUtil {
|
||||
private static final Set<String> SCRIPT_PREFIXES;
|
||||
|
||||
static {
|
||||
Set<String> scriptPrefixes = new HashSet<String>();
|
||||
Set<String> scriptPrefixes = new HashSet<>();
|
||||
for (String scriptName : ScriptUtil.SCRIPT_NAMES) {
|
||||
scriptPrefixes.add(scriptName.concat(":"));
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class MiniLangValidate {
|
||||
* @throws ValidationException If an invalid attribute name is found and <code>validation.level=strict</code>
|
||||
*/
|
||||
public static void attributeNames(SimpleMethod method, Element element, String... validAttributeNames) throws ValidationException {
|
||||
Set<String> validNames = new HashSet<String>();
|
||||
Set<String> validNames = new HashSet<>();
|
||||
for (String name : validAttributeNames) {
|
||||
validNames.add(name);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public final class MiniLangValidate {
|
||||
* @throws ValidationException If an invalid child element is found and <code>validation.level=strict</code>
|
||||
*/
|
||||
public static void childElements(SimpleMethod method, Element element, String... validChildElementNames) throws ValidationException {
|
||||
Set<String> validNames = new HashSet<String>();
|
||||
Set<String> validNames = new HashSet<>();
|
||||
for (String name : validChildElementNames) {
|
||||
validNames.add(name);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ public final class MiniLangValidate {
|
||||
* @throws ValidationException If none of the required child elements are found and <code>validation.level=strict</code>
|
||||
*/
|
||||
public static void requireAnyChildElement(SimpleMethod method, Element element, String... elementNames) throws ValidationException {
|
||||
Set<String> childElementNames = new HashSet<String>();
|
||||
Set<String> childElementNames = new HashSet<>();
|
||||
Node node = element.getFirstChild();
|
||||
while (node != null) {
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
@@ -293,7 +293,7 @@ public final class MiniLangValidate {
|
||||
* @throws ValidationException If any of the required child elements are not found and <code>validation.level=strict</code>
|
||||
*/
|
||||
public static void requiredChildElements(SimpleMethod method, Element element, String... elementNames) throws ValidationException {
|
||||
Set<String> childElementNames = new HashSet<String>();
|
||||
Set<String> childElementNames = new HashSet<>();
|
||||
Node node = element.getFirstChild();
|
||||
while (node != null) {
|
||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SimpleMapProcessor {
|
||||
private static final UtilCache<URL, Map<String, MapProcessor>> simpleMapProcessorsURLCache = UtilCache.createUtilCache("minilang.SimpleMapProcessorsURL", 0, 0);
|
||||
|
||||
protected static Map<String, MapProcessor> getAllProcessors(URL xmlURL) throws MiniLangException {
|
||||
Map<String, MapProcessor> mapProcessors = new HashMap<String, MapProcessor>();
|
||||
Map<String, MapProcessor> mapProcessors = new HashMap<>();
|
||||
// read in the file
|
||||
Document document = null;
|
||||
try {
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class SimpleMethod extends MiniLangElement {
|
||||
private static final UtilCache<String, SimpleMethod> simpleMethodsResourceCache = UtilCache.createUtilCache("minilang.SimpleMethodsResource", 0, 0);
|
||||
|
||||
static {
|
||||
Map<String, MethodOperation.Factory<MethodOperation>> mapFactories = new HashMap<String, MethodOperation.Factory<MethodOperation>>();
|
||||
Map<String, MethodOperation.Factory<MethodOperation>> mapFactories = new HashMap<>();
|
||||
Iterator<MethodOperation.Factory<MethodOperation>> it = UtilGenerics.cast(ServiceLoader.load(MethodOperation.Factory.class, SimpleMethod.class.getClassLoader()).iterator());
|
||||
while (it.hasNext()) {
|
||||
MethodOperation.Factory<MethodOperation> factory = it.next();
|
||||
@@ -123,7 +123,7 @@ public final class SimpleMethod extends MiniLangElement {
|
||||
if (UtilValidate.isEmpty(fromLocation)) {
|
||||
fromLocation = "<location not known>";
|
||||
}
|
||||
Map<String, SimpleMethod> simpleMethods = new HashMap<String, SimpleMethod>();
|
||||
Map<String, SimpleMethod> simpleMethods = new HashMap<>();
|
||||
Document document = null;
|
||||
try {
|
||||
document = UtilXml.readXmlDocument(content, true, true);
|
||||
@@ -135,7 +135,7 @@ public final class SimpleMethod extends MiniLangElement {
|
||||
}
|
||||
|
||||
private static Map<String, SimpleMethod> getAllSimpleMethods(URL xmlURL) throws MiniLangException {
|
||||
Map<String, SimpleMethod> simpleMethods = new LinkedHashMap<String, SimpleMethod>();
|
||||
Map<String, SimpleMethod> simpleMethods = new LinkedHashMap<>();
|
||||
Document document = null;
|
||||
try {
|
||||
document = UtilXml.readXmlDocument(xmlURL, true, true);
|
||||
@@ -220,13 +220,13 @@ public final class SimpleMethod extends MiniLangElement {
|
||||
*/
|
||||
public static List<SimpleMethod> getSimpleMethodsList(String xmlResource, ClassLoader loader) throws MiniLangException {
|
||||
Map<String, SimpleMethod> simpleMethodMap = getSimpleMethods(xmlResource, loader);
|
||||
return new ArrayList<SimpleMethod>(simpleMethodMap.values());
|
||||
return new ArrayList<>(simpleMethodMap.values());
|
||||
}
|
||||
|
||||
public static List<MethodOperation> readOperations(Element simpleMethodElement, SimpleMethod simpleMethod) throws MiniLangException {
|
||||
Assert.notNull("simpleMethodElement", simpleMethodElement, "simpleMethod", simpleMethod);
|
||||
List<? extends Element> operationElements = UtilXml.childElementList(simpleMethodElement);
|
||||
ArrayList<MethodOperation> methodOperations = new ArrayList<MethodOperation>(operationElements.size());
|
||||
ArrayList<MethodOperation> methodOperations = new ArrayList<>(operationElements.size());
|
||||
if (UtilValidate.isNotEmpty(operationElements)) {
|
||||
for (Element curOperElem : operationElements) {
|
||||
String nodeName = UtilXml.getNodeNameIgnorePrefix(curOperElem);
|
||||
@@ -391,7 +391,7 @@ public final class SimpleMethod extends MiniLangElement {
|
||||
private void addMessage(MethodContext methodContext, String messageListName, String message) {
|
||||
List<String> messages = methodContext.getEnv(messageListName);
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<String>();
|
||||
messages = new LinkedList<>();
|
||||
methodContext.putEnv(messageListName, messages);
|
||||
}
|
||||
messages.add(message);
|
||||
|
||||
+3
-3
@@ -28,9 +28,9 @@ import org.apache.ofbiz.minilang.SimpleMethod;
|
||||
*/
|
||||
public final class ArtifactInfoContext {
|
||||
|
||||
private final Set<String> entityNameSet = new HashSet<String>();
|
||||
private final Set<String> serviceNameSet = new HashSet<String>();
|
||||
private final Set<String> simpleMethodNameSet = new HashSet<String>();
|
||||
private final Set<String> entityNameSet = new HashSet<>();
|
||||
private final Set<String> serviceNameSet = new HashSet<>();
|
||||
private final Set<String> simpleMethodNameSet = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Adds an entity name to this context.
|
||||
|
||||
+2
-2
@@ -47,14 +47,14 @@ public final class MethodContext {
|
||||
|
||||
private Delegator delegator;
|
||||
private LocalDispatcher dispatcher;
|
||||
private Map<String, Object> env = new HashMap<String, Object>();
|
||||
private Map<String, Object> env = new HashMap<>();
|
||||
private ClassLoader loader;
|
||||
private Locale locale;
|
||||
private int methodType;
|
||||
private Map<String, Object> parameters;
|
||||
private HttpServletRequest request = null;
|
||||
private HttpServletResponse response = null;
|
||||
private Map<String, Object> results = new HashMap<String, Object>();
|
||||
private Map<String, Object> results = new HashMap<>();
|
||||
private Security security;
|
||||
private TimeZone timeZone;
|
||||
private int traceCount = 0;
|
||||
|
||||
+2
-2
@@ -73,12 +73,12 @@ public final class CallClassMethod extends MethodOperation {
|
||||
this.retFieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("ret-field"));
|
||||
List<? extends Element> parameterElements = UtilXml.childElementList(element);
|
||||
if (parameterElements.size() > 0) {
|
||||
ArrayList<MethodObject<?>> parameterList = new ArrayList<MethodObject<?>>(parameterElements.size());
|
||||
ArrayList<MethodObject<?>> parameterList = new ArrayList<>(parameterElements.size());
|
||||
for (Element parameterElement : parameterElements) {
|
||||
if ("string".equals(parameterElement.getNodeName())) {
|
||||
parameterList.add(new StringObject(parameterElement, simpleMethod));
|
||||
} else if ("field".equals(parameterElement.getNodeName())) {
|
||||
parameterList.add(new FieldObject<Object>(parameterElement, simpleMethod));
|
||||
parameterList.add(new FieldObject<>(parameterElement, simpleMethod));
|
||||
}
|
||||
}
|
||||
parameterList.trimToSize();
|
||||
|
||||
+2
-2
@@ -64,12 +64,12 @@ public final class CallObjectMethod extends MethodOperation {
|
||||
this.retFieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("ret-field"));
|
||||
List<? extends Element> parameterElements = UtilXml.childElementList(element);
|
||||
if (parameterElements.size() > 0) {
|
||||
ArrayList<MethodObject<?>> parameterList = new ArrayList<MethodObject<?>>(parameterElements.size());
|
||||
ArrayList<MethodObject<?>> parameterList = new ArrayList<>(parameterElements.size());
|
||||
for (Element parameterElement : parameterElements) {
|
||||
if ("string".equals(parameterElement.getNodeName())) {
|
||||
parameterList.add(new StringObject(parameterElement, simpleMethod));
|
||||
} else if ("field".equals(parameterElement.getNodeName())) {
|
||||
parameterList.add(new FieldObject<Object>(parameterElement, simpleMethod));
|
||||
parameterList.add(new FieldObject<>(parameterElement, simpleMethod));
|
||||
}
|
||||
}
|
||||
parameterList.trimToSize();
|
||||
|
||||
+8
-8
@@ -113,7 +113,7 @@ public final class CallService extends MethodOperation {
|
||||
defaultMessage = new FlexibleMessage(UtilXml.firstChildElement(element, "default-message"), null);// "service.default.message"
|
||||
List<? extends Element> resultsToMapElements = UtilXml.childElementList(element, "results-to-map");
|
||||
if (UtilValidate.isNotEmpty(resultsToMapElements)) {
|
||||
List<String> resultsToMapList = new ArrayList<String>(resultsToMapElements.size());
|
||||
List<String> resultsToMapList = new ArrayList<>(resultsToMapElements.size());
|
||||
for (Element resultsToMapElement : resultsToMapElements) {
|
||||
resultsToMapList.add(resultsToMapElement.getAttribute("map-name"));
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public final class CallService extends MethodOperation {
|
||||
}
|
||||
List<? extends Element> resultToFieldElements = UtilXml.childElementList(element, "result-to-field");
|
||||
if (UtilValidate.isNotEmpty(resultToFieldElements)) {
|
||||
List<ResultToField> resultToFieldList = new ArrayList<ResultToField>(resultToFieldElements.size());
|
||||
List<ResultToField> resultToFieldList = new ArrayList<>(resultToFieldElements.size());
|
||||
for (Element resultToFieldElement : resultToFieldElements) {
|
||||
resultToFieldList.add(new ResultToField(resultToFieldElement));
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public final class CallService extends MethodOperation {
|
||||
}
|
||||
List<? extends Element> resultToRequestElements = UtilXml.childElementList(element, "result-to-request");
|
||||
if (UtilValidate.isNotEmpty(resultToRequestElements)) {
|
||||
List<ResultToRequest> resultToRequestList = new ArrayList<ResultToRequest>(resultToRequestElements.size());
|
||||
List<ResultToRequest> resultToRequestList = new ArrayList<>(resultToRequestElements.size());
|
||||
for (Element resultToRequestElement : resultToRequestElements) {
|
||||
resultToRequestList.add(new ResultToRequest(resultToRequestElement));
|
||||
}
|
||||
@@ -143,7 +143,7 @@ public final class CallService extends MethodOperation {
|
||||
}
|
||||
List<? extends Element> resultToSessionElements = UtilXml.childElementList(element, "result-to-session");
|
||||
if (UtilValidate.isNotEmpty(resultToSessionElements)) {
|
||||
List<ResultToSession> resultToSessionList = new ArrayList<ResultToSession>(resultToSessionElements.size());
|
||||
List<ResultToSession> resultToSessionList = new ArrayList<>(resultToSessionElements.size());
|
||||
for (Element resultToSessionElement : resultToSessionElements) {
|
||||
resultToSessionList.add(new ResultToSession(resultToSessionElement));
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public final class CallService extends MethodOperation {
|
||||
}
|
||||
List<? extends Element> resultToResultElements = UtilXml.childElementList(element, "result-to-result");
|
||||
if (UtilValidate.isNotEmpty(resultToResultElements)) {
|
||||
List<ResultToResult> resultToResultList = new ArrayList<ResultToResult>(resultToResultElements.size());
|
||||
List<ResultToResult> resultToResultList = new ArrayList<>(resultToResultElements.size());
|
||||
for (Element resultToResultElement : resultToResultElements) {
|
||||
resultToResultList.add(new ResultToResult(resultToResultElement));
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public final class CallService extends MethodOperation {
|
||||
}
|
||||
Map<String, Object> inMap = inMapFma.get(methodContext.getEnvMap());
|
||||
if (inMap == null) {
|
||||
inMap = new HashMap<String, Object>();
|
||||
inMap = new HashMap<>();
|
||||
}
|
||||
// before invoking the service, clear messages
|
||||
if (methodContext.getMethodType() == MethodContext.EVENT) {
|
||||
@@ -419,7 +419,7 @@ public final class CallService extends MethodOperation {
|
||||
private final FlexibleServletAccessor<Object> requestFsa;
|
||||
|
||||
private ResultToRequest(Element element) {
|
||||
requestFsa = new FlexibleServletAccessor<Object>(element.getAttribute("request-name"), element.getAttribute("result-name"));
|
||||
requestFsa = new FlexibleServletAccessor<>(element.getAttribute("request-name"), element.getAttribute("result-name"));
|
||||
resultFma =FlexibleMapAccessor.getInstance(element.getAttribute("result-name"));
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ public final class CallService extends MethodOperation {
|
||||
private final FlexibleServletAccessor<Object> requestFsa;
|
||||
|
||||
private ResultToSession(Element element) {
|
||||
requestFsa = new FlexibleServletAccessor<Object>(element.getAttribute("session-name"), element.getAttribute("result-name"));
|
||||
requestFsa = new FlexibleServletAccessor<>(element.getAttribute("session-name"), element.getAttribute("result-name"));
|
||||
resultFma =FlexibleMapAccessor.getInstance(element.getAttribute("result-name"));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public final class CallServiceAsynch extends MethodOperation {
|
||||
String serviceName = serviceNameFse.expandString(methodContext.getEnvMap());
|
||||
Map<String, Object> inMap = inMapFma.get(methodContext.getEnvMap());
|
||||
if (inMap == null) {
|
||||
inMap = new HashMap<String, Object>();
|
||||
inMap = new HashMap<>();
|
||||
}
|
||||
if (includeUserLogin) {
|
||||
GenericValue userLogin = methodContext.getUserLogin();
|
||||
|
||||
+3
-3
@@ -74,16 +74,16 @@ public final class CallSimpleMapProcessor extends MethodOperation {
|
||||
public boolean exec(MethodContext methodContext) throws MiniLangException {
|
||||
List<Object> messages = errorListFma.get(methodContext.getEnvMap());
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<Object>();
|
||||
messages = new LinkedList<>();
|
||||
errorListFma.put(methodContext.getEnvMap(), messages);
|
||||
}
|
||||
Map<String, Object> inMap = inMapFma.get(methodContext.getEnvMap());
|
||||
if (inMap == null) {
|
||||
inMap = new HashMap<String, Object>();
|
||||
inMap = new HashMap<>();
|
||||
}
|
||||
Map<String, Object> outMap = outMapFma.get(methodContext.getEnvMap());
|
||||
if (outMap == null) {
|
||||
outMap = new HashMap<String, Object>();
|
||||
outMap = new HashMap<>();
|
||||
outMapFma.put(methodContext.getEnvMap(), outMap);
|
||||
}
|
||||
// run external map processor first
|
||||
|
||||
+2
-2
@@ -82,7 +82,7 @@ public final class CallSimpleMethod extends MethodOperation {
|
||||
if (!"function".equals(this.scope)) {
|
||||
MiniLangValidate.handleError("Inline scope cannot include <result-to-field> elements.", simpleMethod, element);
|
||||
}
|
||||
List<ResultToField> resultToFieldList = new ArrayList<ResultToField>(resultToFieldElements.size());
|
||||
List<ResultToField> resultToFieldList = new ArrayList<>(resultToFieldElements.size());
|
||||
for (Element resultToFieldElement : resultToFieldElements) {
|
||||
resultToFieldList.add(new ResultToField(resultToFieldElement, simpleMethod));
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public final class CallSimpleMethod extends MethodOperation {
|
||||
}
|
||||
MethodContext localContext = methodContext;
|
||||
if ("function".equals(this.scope)) {
|
||||
Map<String, Object> localEnv = new HashMap<String, Object>();
|
||||
Map<String, Object> localEnv = new HashMap<>();
|
||||
localEnv.putAll(methodContext.getEnvMap());
|
||||
localEnv.remove(this.simpleMethod.getEventResponseCodeName());
|
||||
localEnv.remove(this.simpleMethod.getServiceResponseMessageName());
|
||||
|
||||
+2
-2
@@ -100,10 +100,10 @@ public final class SetServiceFields extends MethodOperation {
|
||||
}
|
||||
Map<String, Object> toMap = toMapFma.get(methodContext.getEnvMap());
|
||||
if (toMap == null) {
|
||||
toMap = new HashMap<String, Object>();
|
||||
toMap = new HashMap<>();
|
||||
toMapFma.put(methodContext.getEnvMap(), toMap);
|
||||
}
|
||||
List<Object> errorMessages = new LinkedList<Object>();
|
||||
List<Object> errorMessages = new LinkedList<>();
|
||||
Map<String, Object> validAttributes = modelService.makeValid(fromMap, mode, true, errorMessages, methodContext.getTimeZone(), methodContext.getLocale());
|
||||
if (errorMessages.size() > 0) {
|
||||
for (Object obj : errorMessages) {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public abstract class CombinedCondition extends MiniLangElement implements Condi
|
||||
if (MiniLangValidate.validationOn() && childElements.isEmpty()) {
|
||||
MiniLangValidate.handleError("No conditional elements.", simpleMethod, element);
|
||||
}
|
||||
List<Conditional> conditionalList = new ArrayList<Conditional>(childElements.size());
|
||||
List<Conditional> conditionalList = new ArrayList<>(childElements.size());
|
||||
for (Element conditionalElement : UtilXml.childElementList(element)) {
|
||||
conditionalList.add(ConditionalFactory.makeConditional(conditionalElement, simpleMethod));
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public abstract class Compare {
|
||||
}
|
||||
|
||||
private static Map<String, Compare> createInstanceMap() {
|
||||
Map<String, Compare> writableMap = new HashMap<String, Compare>(10);
|
||||
Map<String, Compare> writableMap = new HashMap<>(10);
|
||||
writableMap.put("contains", new CompareContains());
|
||||
writableMap.put("equals", new CompareEquals());
|
||||
writableMap.put("greater", new CompareGreater());
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public abstract class ConditionalFactory<C extends Conditional> {
|
||||
private static final Map<String, ConditionalFactory<?>> conditionalFactories;
|
||||
|
||||
static {
|
||||
Map<String, ConditionalFactory<?>> factories = new HashMap<String, ConditionalFactory<?>>();
|
||||
Map<String, ConditionalFactory<?>> factories = new HashMap<>();
|
||||
Iterator<ConditionalFactory<?>> it = UtilGenerics.cast(ServiceLoader.load(ConditionalFactory.class, ConditionalFactory.class.getClassLoader()).iterator());
|
||||
while (it.hasNext()) {
|
||||
ConditionalFactory<?> factory = it.next();
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public final class MasterIf extends MethodOperation {
|
||||
if (elseIfElements.isEmpty()) {
|
||||
this.elseIfs = null;
|
||||
} else {
|
||||
List<ElseIf> elseIfs = new ArrayList<ElseIf>(elseIfElements.size());
|
||||
List<ElseIf> elseIfs = new ArrayList<>(elseIfElements.size());
|
||||
for (Element elseIfElement : elseIfElements) {
|
||||
elseIfs.add(new ElseIf(elseIfElement, simpleMethod));
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public final class EntityData extends EntityOperation {
|
||||
public boolean exec(MethodContext methodContext) throws MiniLangException {
|
||||
List<Object> messages = errorListFma.get(methodContext.getEnvMap());
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<Object>();
|
||||
messages = new LinkedList<>();
|
||||
errorListFma.put(methodContext.getEnvMap(), messages);
|
||||
}
|
||||
String location = this.locationFse.expandString(methodContext.getEnvMap());
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public final class AddError extends MethodOperation {
|
||||
if (message != null) {
|
||||
List<String> messages = errorListFma.get(methodContext.getEnvMap());
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<String>();
|
||||
messages = new LinkedList<>();
|
||||
errorListFma.put(methodContext.getEnvMap(), messages);
|
||||
}
|
||||
messages.add(message);
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ public final class Assert extends MethodOperation {
|
||||
if (MiniLangValidate.validationOn() && childElements.isEmpty()) {
|
||||
MiniLangValidate.handleError("No conditional elements.", simpleMethod, element);
|
||||
}
|
||||
List<Conditional> conditionalList = new ArrayList<Conditional>(childElements.size());
|
||||
List<Conditional> conditionalList = new ArrayList<>(childElements.size());
|
||||
for (Element conditionalElement : UtilXml.childElementList(element)) {
|
||||
conditionalList.add(ConditionalFactory.makeConditional(conditionalElement, simpleMethod));
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public final class Assert extends MethodOperation {
|
||||
messageBuffer.append("failed: ");
|
||||
condition.prettyPrint(messageBuffer, methodContext);
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<Object>();
|
||||
messages = new LinkedList<>();
|
||||
errorListFma.put(methodContext.getEnvMap(), messages);
|
||||
}
|
||||
messages.add(messageBuffer.toString());
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ public final class CheckId extends MethodOperation {
|
||||
if (message != null) {
|
||||
List<String> messages = errorListFma.get(methodContext.getEnvMap());
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<String>();
|
||||
messages = new LinkedList<>();
|
||||
}
|
||||
errorListFma.put(methodContext.getEnvMap(), messages);
|
||||
messages.add(message.concat(": ").concat(errorMsg));
|
||||
|
||||
+2
-2
@@ -72,12 +72,12 @@ public final class CreateObject extends MethodOperation {
|
||||
fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field"));
|
||||
List<? extends Element> parameterElements = UtilXml.childElementList(element);
|
||||
if (parameterElements.size() > 0) {
|
||||
ArrayList<MethodObject<?>> parameterList = new ArrayList<MethodObject<?>>(parameterElements.size());
|
||||
ArrayList<MethodObject<?>> parameterList = new ArrayList<>(parameterElements.size());
|
||||
for (Element parameterElement : parameterElements) {
|
||||
if ("string".equals(parameterElement.getNodeName())) {
|
||||
parameterList.add(new StringObject(parameterElement, simpleMethod));
|
||||
} else if ("field".equals(parameterElement.getNodeName())) {
|
||||
parameterList.add(new FieldObject<Object>(parameterElement, simpleMethod));
|
||||
parameterList.add(new FieldObject<>(parameterElement, simpleMethod));
|
||||
}
|
||||
}
|
||||
parameterList.trimToSize();
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public final class FieldToList extends MethodOperation {
|
||||
if (fieldVal != null) {
|
||||
List<Object> toList = listFma.get(methodContext.getEnvMap());
|
||||
if (toList == null) {
|
||||
toList = new LinkedList<Object>();
|
||||
toList = new LinkedList<>();
|
||||
listFma.put(methodContext.getEnvMap(), toList);
|
||||
}
|
||||
toList.add(fieldVal);
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public final class ListToList extends MethodOperation {
|
||||
if (fromList != null) {
|
||||
List<Object> toList = toListFma.get(methodContext.getEnvMap());
|
||||
if (toList == null) {
|
||||
toList = new LinkedList<Object>();
|
||||
toList = new LinkedList<>();
|
||||
toListFma.put(methodContext.getEnvMap(), toList);
|
||||
}
|
||||
toList.addAll(fromList);
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public final class MapToMap extends MethodOperation {
|
||||
if (!toMapFma.isEmpty()) {
|
||||
Map<String, Object> toMap = toMapFma.get(methodContext.getEnvMap());
|
||||
if (toMap == null) {
|
||||
toMap = new HashMap<String, Object>();
|
||||
toMap = new HashMap<>();
|
||||
toMapFma.put(methodContext.getEnvMap(), toMap);
|
||||
}
|
||||
toMap.putAll(fromMap);
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public final class OrderMapList extends MethodOperation {
|
||||
listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list"));
|
||||
List<? extends Element> orderByElements = UtilXml.childElementList(element, "order-by");
|
||||
if (orderByElements.size() > 0) {
|
||||
List<FlexibleMapAccessor<String>> orderByList = new ArrayList<FlexibleMapAccessor<String>>(orderByElements.size());
|
||||
List<FlexibleMapAccessor<String>> orderByList = new ArrayList<>(orderByElements.size());
|
||||
for (Element orderByElement : orderByElements) {
|
||||
FlexibleMapAccessor<String> fma = FlexibleMapAccessor.getInstance(orderByElement.getAttribute("field"));
|
||||
orderByList.add(fma);
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ public final class SetOperation extends MethodOperation {
|
||||
if ("NewMap".equals(this.type)) {
|
||||
newValue = new HashMap<String, Object>();
|
||||
} else if ("NewList".equals(this.type)) {
|
||||
newValue = new LinkedList<Object>();
|
||||
newValue = new LinkedList<>();
|
||||
} else {
|
||||
try {
|
||||
String format = null;
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public final class StringToList extends MethodOperation {
|
||||
}
|
||||
List<Object> toList = listFma.get(methodContext.getEnvMap());
|
||||
if (toList == null) {
|
||||
toList = new LinkedList<Object>();
|
||||
toList = new LinkedList<>();
|
||||
listFma.put(methodContext.getEnvMap(), toList);
|
||||
}
|
||||
toList.add(value);
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public final class RequestParametersToList extends MethodOperation {
|
||||
if (parameterValues != null) {
|
||||
List<String> valueList = listFma.get(methodContext.getEnvMap());
|
||||
if (valueList == null) {
|
||||
valueList = new LinkedList<String>();
|
||||
valueList = new LinkedList<>();
|
||||
listFma.put(methodContext.getEnvMap(), valueList);
|
||||
}
|
||||
for (int i = 0; i < parameterValues.length; i++) {
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ public final class CheckPermission extends MethodOperation {
|
||||
primaryPermissionInfo = new PermissionInfo(element);
|
||||
List<? extends Element> altPermElements = UtilXml.childElementList(element, "alt-permission");
|
||||
if (!altPermElements.isEmpty()) {
|
||||
List<PermissionInfo> permissionInfoList = new ArrayList<PermissionInfo>(altPermElements.size());
|
||||
List<PermissionInfo> permissionInfoList = new ArrayList<>(altPermElements.size());
|
||||
for (Element altPermElement : altPermElements) {
|
||||
permissionInfoList.add(new PermissionInfo(altPermElement));
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public final class CheckPermission extends MethodOperation {
|
||||
if (!hasPermission && messageElement != null) {
|
||||
List<String> messages = errorListFma.get(methodContext.getEnvMap());
|
||||
if (messages == null) {
|
||||
messages = new LinkedList<String>();
|
||||
messages = new LinkedList<>();
|
||||
errorListFma.put(methodContext.getEnvMap(), messages);
|
||||
}
|
||||
messages.add(messageElement.getMessage(methodContext));
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class MakeInString {
|
||||
public static final String module = MakeInString.class.getName();
|
||||
|
||||
String fieldName;
|
||||
List<MakeInStringOperation> operations = new ArrayList<MakeInStringOperation>();
|
||||
List<MakeInStringOperation> operations = new ArrayList<>();
|
||||
|
||||
public MakeInString(Element makeInStringElement) {
|
||||
fieldName = makeInStringElement.getAttribute("field");
|
||||
|
||||
+2
-2
@@ -32,9 +32,9 @@ import org.w3c.dom.Element;
|
||||
*/
|
||||
public class MapProcessor {
|
||||
|
||||
List<MakeInString> makeInStrings = new ArrayList<MakeInString>();
|
||||
List<MakeInString> makeInStrings = new ArrayList<>();
|
||||
String name;
|
||||
List<SimpleMapProcess> simpleMapProcesses = new ArrayList<SimpleMapProcess>();
|
||||
List<SimpleMapProcess> simpleMapProcesses = new ArrayList<>();
|
||||
|
||||
public MapProcessor(Element simpleMapProcessorElement) {
|
||||
name = simpleMapProcessorElement.getAttribute("name");
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class SimpleMapProcess {
|
||||
public static final String module = SimpleMapProcess.class.getName();
|
||||
|
||||
String field = "";
|
||||
List<SimpleMapOperation> simpleMapOperations = new ArrayList<SimpleMapOperation>();
|
||||
List<SimpleMapOperation> simpleMapOperations = new ArrayList<>();
|
||||
|
||||
public SimpleMapProcess(Element simpleMapProcessElement) {
|
||||
this.field = simpleMapProcessElement.getAttribute("field");
|
||||
|
||||
Reference in New Issue
Block a user