[OLINGO-1391]Code Improvements

This commit is contained in:
ramya vasanth 2019-09-13 14:28:48 +05:30
parent 8f4d031957
commit 6c2103ccd4
68 changed files with 189 additions and 199 deletions

View File

@ -409,7 +409,7 @@ public class EdmProviderImpl extends AbstractEdm {
try {
CsdlEntityType entType = provider.getEntityType(entitySet.getTypeFQN());
List<CsdlProperty> entTypeProperties = null != entType ?
entType.getProperties() : new ArrayList<CsdlProperty>();
entType.getProperties() : new ArrayList<>();
for (CsdlProperty entTypeProperty : entTypeProperties) {
if (null != entTypeProperty.getType() &&
entTypeProperty.getType().equalsIgnoreCase(typeName.getFullQualifiedNameAsString())) {
@ -465,7 +465,7 @@ public class EdmProviderImpl extends AbstractEdm {
String schemaName = null;
String entitySetName = null;
List<CsdlEntitySet> entitySets = null != csdlEntityContainer ?
csdlEntityContainer.getEntitySets() : new ArrayList<CsdlEntitySet>();
csdlEntityContainer.getEntitySets() : new ArrayList<>();
if (structuralType instanceof CsdlComplexType) {
removeAnnotationsAddedToCTTypePropFromES(structuralType, typeName, csdlEntityContainer, properties, entitySets);
} else {
@ -551,7 +551,7 @@ public class EdmProviderImpl extends AbstractEdm {
try {
CsdlEntityType entType = provider.getEntityType(entitySet.getTypeFQN());
List<CsdlProperty> entTypeProperties = null != entType ?
entType.getProperties() : new ArrayList<CsdlProperty>();
entType.getProperties() : new ArrayList<>();
for (CsdlProperty entTypeProperty : entTypeProperties) {
if (null != entTypeProperty.getType() &&
entTypeProperty.getType().endsWith(DOT + structuralType.getName())) {
@ -792,7 +792,7 @@ public class EdmProviderImpl extends AbstractEdm {
@Override
protected Map<String, String> createAliasToNamespaceInfo() {
final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
final Map<String, String> aliasToNamespaceInfos = new HashMap<>();
try {
final List<CsdlAliasInfo> aliasInfos = provider.getAliasInfos();
if (aliasInfos != null) {
@ -833,7 +833,7 @@ public class EdmProviderImpl extends AbstractEdm {
@Override
protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) {
List<EdmFunction> result = new ArrayList<EdmFunction>();
List<EdmFunction> result = new ArrayList<>();
try {
List<CsdlFunction> functions = functionsMap.get(functionName);
@ -880,7 +880,7 @@ public class EdmProviderImpl extends AbstractEdm {
providerParameters = Collections.emptyList();
}
if (parameterNamesCopy.size() == providerParameters.size()) {
final List<String> functionParameterNames = new ArrayList<String>();
final List<String> functionParameterNames = new ArrayList<>();
for (CsdlParameter parameter : providerParameters) {
functionParameterNames.add(parameter.getName());
}
@ -902,7 +902,7 @@ public class EdmProviderImpl extends AbstractEdm {
@Override
protected Map<String, EdmSchema> createSchemas() {
try {
final Map<String, EdmSchema> providerSchemas = new LinkedHashMap<String, EdmSchema>();
final Map<String, EdmSchema> providerSchemas = new LinkedHashMap<>();
List<CsdlSchema> localSchemas = provider.getSchemas();
if (localSchemas != null) {
for (CsdlSchema schema : localSchemas) {

View File

@ -162,7 +162,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmTypeDefinition> createTypeDefinitions() {
final List<EdmTypeDefinition> typeDefns = new ArrayList<EdmTypeDefinition>();
final List<EdmTypeDefinition> typeDefns = new ArrayList<>();
final List<CsdlTypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
if (providerTypeDefinitions != null) {
for (CsdlTypeDefinition def : providerTypeDefinitions) {
@ -177,7 +177,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmEnumType> createEnumTypes() {
final List<EdmEnumType> enumTyps = new ArrayList<EdmEnumType>();
final List<EdmEnumType> enumTyps = new ArrayList<>();
final List<CsdlEnumType> providerEnumTypes = schema.getEnumTypes();
if (providerEnumTypes != null) {
for (CsdlEnumType enumType : providerEnumTypes) {
@ -192,7 +192,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmEntityType> createEntityTypes() {
final List<EdmEntityType> edmEntityTypes = new ArrayList<EdmEntityType>();
final List<EdmEntityType> edmEntityTypes = new ArrayList<>();
final List<CsdlEntityType> providerEntityTypes = schema.getEntityTypes();
if (providerEntityTypes != null) {
for (CsdlEntityType entityType : providerEntityTypes) {
@ -207,7 +207,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmComplexType> createComplexTypes() {
final List<EdmComplexType> edmComplexTypes = new ArrayList<EdmComplexType>();
final List<EdmComplexType> edmComplexTypes = new ArrayList<>();
final List<CsdlComplexType> providerComplexTypes = schema.getComplexTypes();
if (providerComplexTypes != null) {
for (CsdlComplexType complexType : providerComplexTypes) {
@ -222,7 +222,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmAction> createActions() {
final List<EdmAction> edmActions = new ArrayList<EdmAction>();
final List<EdmAction> edmActions = new ArrayList<>();
final List<CsdlAction> providerActions = schema.getActions();
if (providerActions != null) {
for (CsdlAction action : providerActions) {
@ -237,7 +237,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmFunction> createFunctions() {
final List<EdmFunction> edmFunctions = new ArrayList<EdmFunction>();
final List<EdmFunction> edmFunctions = new ArrayList<>();
final List<CsdlFunction> providerFunctions = schema.getFunctions();
if (providerFunctions != null) {
for (CsdlFunction function : providerFunctions) {
@ -252,7 +252,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmTerm> createTerms() {
final List<EdmTerm> edmTerms = new ArrayList<EdmTerm>();
final List<EdmTerm> edmTerms = new ArrayList<>();
final List<CsdlTerm> providerTerms = schema.getTerms();
if (providerTerms != null) {
for (CsdlTerm term : providerTerms) {
@ -266,7 +266,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmAnnotations> createAnnotationGroups() {
final List<EdmAnnotations> edmAnnotationGroups = new ArrayList<EdmAnnotations>();
final List<EdmAnnotations> edmAnnotationGroups = new ArrayList<>();
final List<CsdlAnnotations> providerAnnotations =
schema.getAnnotationGroups();
if (providerAnnotations != null) {
@ -286,7 +286,7 @@ public class EdmSchemaImpl extends AbstractEdmAnnotatable implements EdmSchema {
}
protected List<EdmAnnotation> createAnnotations() {
final List<EdmAnnotation> edmAnnotations = new ArrayList<EdmAnnotation>();
final List<EdmAnnotation> edmAnnotations = new ArrayList<>();
final List<CsdlAnnotation> providerAnnotations =
schema.getAnnotations();
if (providerAnnotations != null) {

View File

@ -75,7 +75,7 @@ public class EdmTermImpl extends AbstractEdmNamed implements EdmTerm {
@Override
public List<TargetType> getAppliesTo() {
if (appliesTo == null) {
ArrayList<TargetType> localAppliesTo = new ArrayList<TargetType>();
ArrayList<TargetType> localAppliesTo = new ArrayList<>();
for (String apply : term.getAppliesTo()) {
try {
localAppliesTo.add(TargetType.valueOf(apply));

View File

@ -45,7 +45,7 @@ public final class FunctionMapKey {
}
this.bindingParameterTypeName = bindingParameterTypeName;
this.isBindingParameterCollection = isBindingParameterCollection;
this.parameterNames = new ArrayList<String>();
this.parameterNames = new ArrayList<>();
if (parameterNames != null) {
this.parameterNames.addAll(parameterNames);
Collections.sort(this.parameterNames);

View File

@ -55,7 +55,7 @@ public class EdmApplyImpl extends AbstractEdmAnnotatableDynamicExpression implem
@Override
public List<EdmExpression> getParameters() {
if (parameters == null) {
List<EdmExpression> localParameters = new ArrayList<EdmExpression>();
List<EdmExpression> localParameters = new ArrayList<>();
if (csdlExp.getParameters() != null) {
for (CsdlExpression param : csdlExp.getParameters()) {
localParameters.add(getExpression(edm, param));

View File

@ -41,7 +41,7 @@ public class EdmCollectionImpl extends AbstractEdmDynamicExpression implements E
@Override
public List<EdmExpression> getItems() {
if (items == null) {
List<EdmExpression> localItems = new ArrayList<EdmExpression>();
List<EdmExpression> localItems = new ArrayList<>();
if (csdlCollection.getItems() != null) {
for (CsdlExpression item : csdlCollection.getItems()) {
localItems.add(getExpression(edm, item));

View File

@ -58,7 +58,7 @@ public class EdmConstantExpressionImpl extends AbstractEdmExpression implements
if (csdlExp.getValue() == null) {
throw new EdmException("Expression value must not be null");
}
final List<String> localEnumValues = new ArrayList<String>();
final List<String> localEnumValues = new ArrayList<>();
for (String split : csdlExp.getValue().split(" ")) {
final String[] enumSplit = split.split("/");
if (enumSplit.length != 2) {

View File

@ -45,7 +45,7 @@ public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicExpression imple
@Override
public List<EdmPropertyValue> getPropertyValues() {
if (propertyValues == null) {
List<EdmPropertyValue> localValues = new ArrayList<EdmPropertyValue>();
List<EdmPropertyValue> localValues = new ArrayList<>();
if (record.getPropertyValues() != null) {
for (CsdlPropertyValue value : record.getPropertyValues()) {
localValues.add(new EdmPropertyValueImpl(edm, value));

View File

@ -117,7 +117,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
final Matcher matcher = getMatcher(PATTERN, value);
final List<Point> points = new ArrayList<Point>();
final List<Point> points = new ArrayList<>();
for (final String pointCoo : split(matcher.group(4), ',')) {
points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1),
isNullable, maxLength, precision, scale, isUnicode));
@ -130,7 +130,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
final Integer maxLength, final Integer precision, final Integer scale, final Boolean isUnicode)
throws EdmPrimitiveTypeException {
final List<Point> points = new ArrayList<Point>();
final List<Point> points = new ArrayList<>();
for (final String pointCoo : split(lineString, ',')) {
points.add(newPoint(null, pointCoo, isNullable, maxLength, precision, scale, isUnicode));
}
@ -153,7 +153,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
final Matcher matcher = getMatcher(PATTERN, value);
final List<LineString> lineStrings = new ArrayList<LineString>();
final List<LineString> lineStrings = new ArrayList<>();
for (String coo : matcher.group(4).contains("),(")
? matcher.group(4).split("\\),\\(") : new String[] { matcher.group(4) }) {
@ -177,7 +177,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
final String[] first = polygon.split("\\),\\(");
final List<LineString> interiorRings = new ArrayList<LineString>();
final List<LineString> interiorRings = new ArrayList<>();
for (int i = 0; i < first.length -1; i++) {
List<Point> interior = new ArrayList<Point>();
for (final String pointCoo : split(first[i].substring(i==0?1:0, first[i].length()), ',')) {
@ -207,7 +207,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
final Matcher matcher = getMatcher(PATTERN, value);
final List<Polygon> polygons = new ArrayList<Polygon>();
final List<Polygon> polygons = new ArrayList<>();
for (String coo : matcher.group(4).contains(")),((") ?
matcher.group(4).split("\\)\\),\\(\\(") :
new String[] { matcher.group(4) }) {
@ -246,7 +246,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
break;
case MULTIPOINT:
final List<Point> points = new ArrayList<Point>();
final List<Point> points = new ArrayList<>();
for (final String pointCoo : split(matcher.group(4), ',')) {
points.add(newPoint(null, pointCoo.substring(1, pointCoo.length() - 1),
isNullable, maxLength, precision, scale, isUnicode));
@ -261,7 +261,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
break;
case MULTILINESTRING:
final List<LineString> lineStrings = new ArrayList<LineString>();
final List<LineString> lineStrings = new ArrayList<>();
for (final String coo : split(matcher.group(4), ',')) {
lineStrings.add(newLineString(null, coo.substring(1, coo.length() - 1),
isNullable, maxLength, precision, scale, isUnicode));
@ -276,7 +276,7 @@ public abstract class AbstractGeospatialType<T extends Geospatial> extends Singl
break;
case MULTIPOLYGON:
final List<Polygon> polygons = new ArrayList<Polygon>();
final List<Polygon> polygons = new ArrayList<>();
for (final String coo : split(matcher.group(4), ',')) {
polygons.add(newPolygon(null, coo.substring(1, coo.length() - 1),
isNullable, maxLength, precision, scale, isUnicode));

View File

@ -31,7 +31,7 @@ import java.util.Map;
* @see ODataResponse
*/
final class HttpHeaders {
private final Map<String, List<String>> headers = new LinkedHashMap<String, List<String>>();
private final Map<String, List<String>> headers = new LinkedHashMap<>();
/**
* Adds a header with given name and value.
@ -44,7 +44,7 @@ final class HttpHeaders {
final String canonicalName = getCanonicalName(name);
List<String> header = headers.get(canonicalName);
if (header == null) {
header = new ArrayList<String>();
header = new ArrayList<>();
}
header.add(value);
headers.put(canonicalName, header);
@ -62,7 +62,7 @@ final class HttpHeaders {
final String canonicalName = getCanonicalName(name);
List<String> header = headers.get(canonicalName);
if (header == null) {
header = new ArrayList<String>();
header = new ArrayList<>();
}
header.addAll(values);
headers.put(canonicalName, header);

View File

@ -28,7 +28,7 @@ import org.apache.olingo.server.api.ODataRequest;
* Represents a distinct MIME part of a Batch Request body - either a Change Set or a Query Operation
*/
public class BatchRequestPart {
private List<ODataRequest> requests = new ArrayList<ODataRequest>();
private List<ODataRequest> requests = new ArrayList<>();
private boolean isChangeSet;
/**
@ -48,7 +48,7 @@ public class BatchRequestPart {
*/
public BatchRequestPart(final boolean isChangeSet, final ODataRequest request) {
this.isChangeSet = isChangeSet;
requests = new ArrayList<ODataRequest>();
requests = new ArrayList<>();
requests.add(request);
}

View File

@ -35,11 +35,11 @@ import org.apache.olingo.server.api.prefer.Preferences.Return;
*/
public final class PreferencesApplied {
private static final Set<String> SAFE_PREFERENCE_NAMES = new HashSet<String>();
private static final Set<String> SAFE_PREFERENCE_NAMES = new HashSet<>();
private Map<String, String> applied;
private PreferencesApplied() {
applied = new LinkedHashMap<String, String>();
applied = new LinkedHashMap<>();
}
/**

View File

@ -103,7 +103,7 @@ public class MetadataParser {
private boolean useLocalCoreVocabularies = true;
private boolean implicitlyLoadCoreVocabularies = false;
private boolean recursivelyLoadReferences = false;
private Map<String, SchemaBasedEdmProvider> globalReferenceMap = new HashMap<String, SchemaBasedEdmProvider>();
private Map<String, SchemaBasedEdmProvider> globalReferenceMap = new HashMap<>();
/**
* Avoid reading the annotations in the $metadata

View File

@ -48,19 +48,19 @@ import org.apache.olingo.commons.api.edmx.EdmxReferenceInclude;
import org.apache.olingo.commons.api.ex.ODataException;
public class SchemaBasedEdmProvider implements CsdlEdmProvider {
private final List<CsdlSchema> edmSchemas = new ArrayList<CsdlSchema>();
private final Map<String, EdmxReference> references = new ConcurrentHashMap<String, EdmxReference>();
private final List<CsdlSchema> edmSchemas = new ArrayList<>();
private final Map<String, EdmxReference> references = new ConcurrentHashMap<>();
private final Map<String, SchemaBasedEdmProvider> referenceSchemas =
new ConcurrentHashMap<String, SchemaBasedEdmProvider>();
new ConcurrentHashMap<>();
private final Map<String, SchemaBasedEdmProvider> coreVocabularySchemas =
new ConcurrentHashMap<String, SchemaBasedEdmProvider>();
new ConcurrentHashMap<>();
protected void addSchema(CsdlSchema schema) {
this.edmSchemas.add(schema);
}
public List<EdmxReference> getReferences(){
return new ArrayList<EdmxReference>(references.values());
return new ArrayList<>(references.values());
}
protected void addReferenceSchema(String ns, SchemaBasedEdmProvider provider) {
@ -164,7 +164,7 @@ public class SchemaBasedEdmProvider implements CsdlEdmProvider {
@Override
public List<CsdlFunction> getFunctions(FullQualifiedName fqn) throws ODataException {
ArrayList<CsdlFunction> foundFuncs = new ArrayList<CsdlFunction>();
ArrayList<CsdlFunction> foundFuncs = new ArrayList<>();
CsdlSchema schema = getSchema(fqn.getNamespace());
if (schema != null) {
List<CsdlFunction> functions = schema.getFunctions();
@ -292,7 +292,7 @@ public class SchemaBasedEdmProvider implements CsdlEdmProvider {
@Override
public List<CsdlAliasInfo> getAliasInfos() throws ODataException {
ArrayList<CsdlAliasInfo> list = new ArrayList<CsdlAliasInfo>();
ArrayList<CsdlAliasInfo> list = new ArrayList<>();
for (CsdlSchema s : this.edmSchemas) {
if (s.getAlias() != null) {
CsdlAliasInfo ai = new CsdlAliasInfo();
@ -338,7 +338,7 @@ public class SchemaBasedEdmProvider implements CsdlEdmProvider {
@Override
public List<CsdlSchema> getSchemas() throws ODataException {
return new ArrayList<CsdlSchema>(this.edmSchemas);
return new ArrayList<>(this.edmSchemas);
}
@Override
@ -369,7 +369,7 @@ public class SchemaBasedEdmProvider implements CsdlEdmProvider {
@Override
public List<CsdlAction> getActions(final FullQualifiedName fqn) throws ODataException {
ArrayList<CsdlAction> actions = new ArrayList<CsdlAction>();
ArrayList<CsdlAction> actions = new ArrayList<>();
CsdlSchema schema = getSchema(fqn.getNamespace());
if (schema != null) {
List<CsdlAction> types = schema.getActions();

View File

@ -97,9 +97,7 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor {
internalExecute(uriInfo, odRequest, odResponse);
}
return;
} catch(ODataLibraryException e) {
oDataException = e;
} catch(ODataApplicationException e) {
} catch(ODataLibraryException | ODataApplicationException e) {
oDataException = e;
}
ContentType contentType = ContentType.JSON;

View File

@ -281,7 +281,7 @@ public abstract class ServiceRequest {
}
public Map<String, String> getPreferences(){
HashMap<String, String> map = new HashMap<String, String>();
HashMap<String, String> map = new HashMap<>();
List<String> headers = request.getHeaders(HttpHeader.PREFER);
if (headers != null) {
for (String header:headers) {

View File

@ -60,7 +60,7 @@ public class ODataHandlerImpl implements ODataHandler {
private final OData odata;
private final ServiceMetadata serviceMetadata;
private final List<Processor> processors = new LinkedList<Processor>();
private final List<Processor> processors = new LinkedList<>();
private final ServerCoreDebugger debugger;
private CustomContentTypeSupport customContentTypeSupport;

View File

@ -108,7 +108,7 @@ public class ODataHttpHandlerImpl implements ODataHttpHandler {
}
private Map<String, String> createEnvironmentVariablesMap(final HttpServletRequest request) {
Map<String, String> environment = new LinkedHashMap<String, String>();
Map<String, String> environment = new LinkedHashMap<>();
environment.put("authType", request.getAuthType());
environment.put("localAddr", request.getLocalAddr());
environment.put("localName", request.getLocalName());

View File

@ -96,7 +96,7 @@ public class ODataImpl extends OData {
final List<String> versions) throws SerializerException {
ODataSerializer serializer = null;
IConstants constants = new Constantsv00();
if(versions!=null && versions.size()>0 && getMaxVersion(versions)>4){
if(versions!=null && !versions.isEmpty() && getMaxVersion(versions) > 4){
constants = new Constantsv01() ;
}
if (contentType != null && contentType.isCompatible(ContentType.APPLICATION_JSON)) {
@ -255,7 +255,7 @@ public class ODataImpl extends OData {
public ODataDeserializer createDeserializer(ContentType contentType, List<String> versions)
throws DeserializerException {
IConstants constants = new Constantsv00();
if(versions!=null && versions.size()>0 && getMaxVersion(versions)>4){
if(versions!=null && !versions.isEmpty() && getMaxVersion(versions)>4){
constants = new Constantsv01() ;
}
if (contentType != null && contentType.isCompatible(ContentType.JSON)) {
@ -276,7 +276,7 @@ public class ODataImpl extends OData {
public ODataDeserializer createDeserializer(ContentType contentType, ServiceMetadata metadata, List<String> versions)
throws DeserializerException {
IConstants constants = new Constantsv00();
if(versions!=null && versions.size()>0 && getMaxVersion(versions)>4){
if(versions!=null && !versions.isEmpty() && getMaxVersion(versions)>4){
constants = new Constantsv01() ;
}
if (contentType != null && contentType.isCompatible(ContentType.JSON)) {

View File

@ -41,7 +41,7 @@ public class ServiceMetadataImpl implements ServiceMetadata {
public ServiceMetadataImpl(final CsdlEdmProvider edmProvider, final List<EdmxReference> references,
final ServiceMetadataETagSupport serviceMetadataETagSupport) {
edm = new EdmProviderImpl(edmProvider);
this.references = new ArrayList<EdmxReference>();
this.references = new ArrayList<>();
this.references.addAll(references);
this.serviceMetadataETagSupport = serviceMetadataETagSupport;
}

View File

@ -35,7 +35,7 @@ public class BatchReferenceRewriter {
private static final String REG_EX_REFERENCE = "\\$(.*)(/.*)?";
private static final Pattern REFERENCE_PATTERN = Pattern.compile(REG_EX_REFERENCE);
private Map<String, String> contentIdMapping = new HashMap<String, String>();
private Map<String, String> contentIdMapping = new HashMap<>();
public String getReferenceInURI(final ODataRequest request) {
Matcher matcher = REFERENCE_PATTERN.matcher(removeSlash(removeSlash(request.getRawODataPath(), true), false));

View File

@ -97,7 +97,7 @@ public class DebugResponseHelperImpl implements DebugResponseHelper {
}
private List<DebugTab> createParts(final DebugInformation debugInfo) {
List<DebugTab> parts = new ArrayList<DebugTab>();
List<DebugTab> parts = new ArrayList<>();
// request
parts.add(new DebugTabRequest(debugInfo.getRequest()));

View File

@ -83,7 +83,7 @@ public class DebugTabResponse implements DebugTab {
}
private Map<String, String> map(final Map<String, List<String>> headers) {
Map<String, String> result = new HashMap<String, String>();
Map<String, String> result = new HashMap<>();
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
if (entry.getValue().size() == 1) {
result.put(entry.getKey(), entry.getValue().get(0));

View File

@ -124,7 +124,7 @@ public class DebugTabRuntime implements DebugTab {
private String methodName;
private long timeStarted;
private long timeStopped;
private List<RuntimeNode> children = new ArrayList<RuntimeNode>();
private List<RuntimeNode> children = new ArrayList<>();
protected RuntimeNode() {
timeStarted = 0;

View File

@ -235,7 +235,7 @@ public class DebugTabUri implements DebugTab {
private void appendParameters(final JsonGenerator gen, final String name, final List<UriParameter> parameters)
throws IOException {
if (!parameters.isEmpty()) {
Map<String, String> parameterMap = new LinkedHashMap<String, String>();
Map<String, String> parameterMap = new LinkedHashMap<>();
for (final UriParameter parameter : parameters) {
parameterMap.put(parameter.getName(),
parameter.getText() == null ? parameter.getAlias() : parameter.getText());
@ -611,7 +611,7 @@ public class DebugTabUri implements DebugTab {
}
private Map<String, String> getQueryOptionsMap(final List<? extends QueryOption> queryOptions) {
Map<String, String> options = new LinkedHashMap<String, String>();
Map<String, String> options = new LinkedHashMap<>();
for (final QueryOption option : queryOptions) {
if (option != null) {
options.put(option.getName(), option.getText());

View File

@ -41,7 +41,7 @@ import org.apache.olingo.server.api.uri.UriInfo;
public class ServerCoreDebugger {
private static final Charset DEFAULT_ENCODING = Charset.forName("UTF-8");
private final List<RuntimeMeasurement> runtimeInformation = new ArrayList<RuntimeMeasurement>();
private final List<RuntimeMeasurement> runtimeInformation = new ArrayList<>();
private final OData odata;
private boolean isDebugMode = false;

View File

@ -89,8 +89,8 @@ public class DeserializerResultImpl implements DeserializerResult {
result.entitySet = entitySet;
result.expandOption = expandOption;
result.property = property;
result.entityReferences = (entityReferences == null) ? new ArrayList<URI>() : entityReferences;
result.actionParameters = (actionParameters == null) ? new LinkedHashMap<String, Parameter>() : actionParameters;
result.entityReferences = (entityReferences == null) ? new ArrayList<>() : entityReferences;
result.actionParameters = (actionParameters == null) ? new LinkedHashMap<>() : actionParameters;
return result;
}

View File

@ -28,7 +28,7 @@ import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerExceptio
public class BatchBodyPart implements BatchPart {
private final String boundary;
private final boolean isStrict;
private final List<Line> remainingMessage = new LinkedList<Line>();
private final List<Line> remainingMessage = new LinkedList<>();
private Header headers;
private boolean isChangeSet;
@ -75,7 +75,7 @@ public class BatchBodyPart implements BatchPart {
private List<BatchQueryOperation> consumeChangeSet(final List<Line> remainingMessage)
throws BatchDeserializerException {
final List<List<Line>> changeRequests = splitChangeSet(remainingMessage);
final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
final List<BatchQueryOperation> requestList = new LinkedList<>();
for (List<Line> changeRequest : changeRequests) {
requestList.add(new BatchChangeSetPart(changeRequest, isStrict).parse());
@ -105,7 +105,7 @@ public class BatchBodyPart implements BatchPart {
private List<BatchQueryOperation> consumeQueryOperation(final List<Line> remainingMessage)
throws BatchDeserializerException {
final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
final List<BatchQueryOperation> requestList = new LinkedList<>();
requestList.add(new BatchQueryOperation(remainingMessage, isStrict).parse());
return requestList;

View File

@ -63,7 +63,7 @@ public class BatchLineReader {
}
public List<String> toList() throws IOException {
final List<String> result = new ArrayList<String>();
final List<String> result = new ArrayList<>();
String currentLine = readLine();
if (currentLine != null) {
currentBoundary = currentLine.trim();
@ -77,7 +77,7 @@ public class BatchLineReader {
}
public List<Line> toLineList() throws IOException {
final List<Line> result = new ArrayList<Line>();
final List<Line> result = new ArrayList<>();
String currentLine = readLine();
if (currentLine != null) {
currentBoundary = currentLine.trim();

View File

@ -54,7 +54,7 @@ public class BatchParser {
private List<BatchRequestPart> parseBatch(final InputStream in, final String boundary,
final BatchRequestTransformator transformator) throws IOException, BatchDeserializerException {
final List<BatchRequestPart> resultList = new LinkedList<BatchRequestPart>();
final List<BatchRequestPart> resultList = new LinkedList<>();
final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary);
for (List<Line> bodyPartString : bodyPartStrings) {

View File

@ -113,8 +113,8 @@ public class BatchParserCommon {
public static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
throws BatchDeserializerException {
final List<List<Line>> messageParts = new LinkedList<List<Line>>();
List<Line> currentPart = new LinkedList<Line>();
final List<List<Line>> messageParts = new LinkedList<>();
List<Line> currentPart = new LinkedList<>();
boolean isEndReached = false;
final String quotedBoundary = Pattern.quote(boundary);
@ -129,7 +129,7 @@ public class BatchParserCommon {
} else if (boundaryPattern.matcher(currentLine.toString()).matches()) {
removeEndingCRLFFromList(currentPart);
messageParts.add(currentPart);
currentPart = new LinkedList<Line>();
currentPart = new LinkedList<>();
} else {
currentPart.add(currentLine);
}

View File

@ -43,8 +43,8 @@ public class BatchRequestTransformator {
}
public List<BatchRequestPart> transform(final BatchBodyPart bodyPart) throws BatchDeserializerException {
final List<ODataRequest> requests = new LinkedList<ODataRequest>();
final List<BatchRequestPart> resultList = new ArrayList<BatchRequestPart>();
final List<ODataRequest> requests = new LinkedList<>();
final List<BatchRequestPart> resultList = new ArrayList<>();
validateHeaders(bodyPart.getHeaders(), bodyPart.isChangeSet());

View File

@ -26,7 +26,7 @@ import java.util.Locale;
import java.util.Map;
public class Header implements Iterable<HeaderField>, Cloneable {
private Map<String, HeaderField> headers = new HashMap<String, HeaderField>();
private Map<String, HeaderField> headers = new HashMap<>();
private int lineNumber;
public Header(final int lineNumer) {
@ -76,7 +76,7 @@ public class Header implements Iterable<HeaderField>, Cloneable {
public List<String> getHeaders(final String name) {
final HeaderField headerField = getHeaderField(name);
return (headerField == null) ? new ArrayList<String>() : headerField.getValues();
return (headerField == null) ? new ArrayList<>() : headerField.getValues();
}
public HeaderField getHeaderField(final String name) {
@ -88,7 +88,7 @@ public class Header implements Iterable<HeaderField>, Cloneable {
}
public Map<String, String> toSingleMap() {
final Map<String, String> singleMap = new HashMap<String, String>();
final Map<String, String> singleMap = new HashMap<>();
for (final Map.Entry<String, HeaderField> entries : headers.entrySet()) {
HeaderField field = entries.getValue();
@ -99,7 +99,7 @@ public class Header implements Iterable<HeaderField>, Cloneable {
}
public Map<String, List<String>> toMultiMap() {
final Map<String, List<String>> singleMap = new HashMap<String, List<String>>();
final Map<String, List<String>> singleMap = new HashMap<>();
for (final Map.Entry<String, HeaderField> entries : headers.entrySet()) {
HeaderField field = entries.getValue();
@ -123,7 +123,7 @@ public class Header implements Iterable<HeaderField>, Cloneable {
public Header clone() throws CloneNotSupportedException{
Header clone = (Header) super.clone();
clone.lineNumber = lineNumber;
clone.headers = new HashMap<String, HeaderField>();
clone.headers = new HashMap<>();
for (final Map.Entry<String, HeaderField> entries : headers.entrySet()) {
clone.headers.put(entries.getKey(), entries.getValue().clone());
}
@ -154,7 +154,7 @@ public class Header implements Iterable<HeaderField>, Cloneable {
}
public static List<String> splitValuesByComma(final String headerValue) {
final List<String> singleValues = new ArrayList<String>();
final List<String> singleValues = new ArrayList<>();
String[] parts = headerValue.split(",");
for (final String value : parts) {

View File

@ -62,7 +62,7 @@ public class HeaderField implements Cloneable {
@Override
public HeaderField clone() throws CloneNotSupportedException{
HeaderField clone = (HeaderField) super.clone();
clone.values = new ArrayList<String>(values.size());
clone.values = new ArrayList<>(values.size());
clone.values.addAll(values);
return clone;
}

View File

@ -33,7 +33,7 @@ import org.apache.olingo.server.api.deserializer.batch.BatchDeserializerExceptio
public class HttpRequestStatusLine {
private static final Pattern PATTERN_RELATIVE_URI = Pattern.compile("([^/][^?]*)(?:\\?(.*))?");
private static final Set<HttpMethod> HTTP_CHANGE_SET_METHODS = new HashSet<HttpMethod>(Arrays.asList(
private static final Set<HttpMethod> HTTP_CHANGE_SET_METHODS = new HashSet<>(Arrays.asList(
new HttpMethod[] { HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE, HttpMethod.PATCH }));
private static final String HTTP_VERSION = "HTTP/1.1";

View File

@ -28,7 +28,7 @@ import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
public class ExpandTreeBuilderImpl extends ExpandTreeBuilder {
private final Map<String, ExpandTreeBuilder> childBuilderCache = new HashMap<String, ExpandTreeBuilder>();
private final Map<String, ExpandTreeBuilder> childBuilderCache = new HashMap<>();
private final ExpandItemImpl parentItem;
private ExpandOptionImpl expandOption = null;

View File

@ -97,7 +97,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
private static final Map<String, Class<? extends Geospatial>> jsonNameToGeoDataType;
static {
Map<String, Class<? extends Geospatial>> temp = new HashMap<String, Class<? extends Geospatial>>();
Map<String, Class<? extends Geospatial>> temp = new HashMap<>();
temp.put(Constants.ELEM_POINT, Point.class);
temp.put(Constants.ELEM_MULTIPOINT, MultiPoint.class);
temp.put(Constants.ELEM_LINESTRING, LineString.class);
@ -174,7 +174,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
private List<Entity> consumeEntitySetArray(final EdmEntityType edmEntityType, final JsonNode jsonNode,
final ExpandTreeBuilder expandBuilder) throws DeserializerException {
if (jsonNode.isArray()) {
List<Entity> entities = new ArrayList<Entity>();
List<Entity> entities = new ArrayList<>();
for (JsonNode arrayElement : jsonNode) {
if (arrayElement.isArray() || arrayElement.isValueNode()) {
throw new DeserializerException("Nested Arrays and primitive values are not allowed for an entity value.",
@ -213,7 +213,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
entity.setType(edmEntityType.getFullQualifiedName().getFullQualifiedNameAsString());
// Check and consume @id for v4.01
consumeId(edmEntityType, tree, entity);
consumeId(tree, entity);
// Check and consume all Properties
consumeEntityProperties(edmEntityType, tree, entity);
@ -288,7 +288,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
}
private void consumeId(EdmEntityType edmEntityType, ObjectNode node, Entity entity)
private void consumeId(ObjectNode node, Entity entity)
throws DeserializerException {
if (node.get(constants.getId()) != null && constants instanceof Constantsv01) {
try {
@ -338,7 +338,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
// The binding parameter must not occur in the payload.
parameterNames = parameterNames.subList(1, parameterNames.size());
}
Map<String, Parameter> parameters = new LinkedHashMap<String, Parameter>();
Map<String, Parameter> parameters = new LinkedHashMap<>();
for (final String paramName : parameterNames) {
final EdmParameter edmParameter = edmAction.getParameter(paramName);
@ -429,7 +429,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
*/
private void consumeRemainingJsonNodeFields(final EdmEntityType edmEntityType, final ObjectNode node,
final Entity entity) throws DeserializerException {
final List<String> toRemove = new ArrayList<String>();
final List<String> toRemove = new ArrayList<>();
Iterator<Entry<String, JsonNode>> fieldsIterator = node.fields();
while (fieldsIterator.hasNext()) {
Entry<String, JsonNode> field = fieldsIterator.next();
@ -548,7 +548,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
throw new DeserializerException("Binding annotation: " + key + " must be an array.",
DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key);
}
List<String> bindingLinkStrings = new ArrayList<String>();
List<String> bindingLinkStrings = new ArrayList<>();
for (JsonNode arrayValue : jsonNode) {
assertIsNullNode(key, arrayValue);
if (!arrayValue.isTextual()) {
@ -649,7 +649,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
throw new DeserializerException("Value for property: " + name + " must be an array but is not.",
DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, name);
}
List<Object> valueArray = new ArrayList<Object>();
List<Object> valueArray = new ArrayList<>();
Iterator<JsonNode> iterator = jsonNode.iterator();
switch (type.getKind()) {
case PRIMITIVE:
@ -793,7 +793,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
// Therefore the required minimal size of the points array currently is zero.
return new LineString(dimension, srid, readGeoPointValues(name, dimension, 0, false, topNode));
} else if (geoDataType.equals(MultiLineString.class)) {
List<LineString> lines = new ArrayList<LineString>();
List<LineString> lines = new ArrayList<>();
for (final JsonNode element : topNode) {
// Line strings can be empty (see above).
lines.add(new LineString(dimension, srid, readGeoPointValues(name, dimension, 0, false, element)));
@ -802,13 +802,13 @@ public class ODataJsonDeserializer implements ODataDeserializer {
} else if (geoDataType.equals(Polygon.class)) {
return readGeoPolygon(name, dimension, topNode, srid);
} else if (geoDataType.equals(MultiPolygon.class)) {
List<Polygon> polygons = new ArrayList<Polygon>();
List<Polygon> polygons = new ArrayList<>();
for (final JsonNode element : topNode) {
polygons.add(readGeoPolygon(name, dimension, element, null));
}
return new MultiPolygon(dimension, srid, polygons);
} else if (geoDataType.equals(GeospatialCollection.class)) {
List<Geospatial> elements = new ArrayList<Geospatial>();
List<Geospatial> elements = new ArrayList<>();
for (final JsonNode element : topNode) {
if (element.isObject()) {
elements.add(readPrimitiveGeoValue(name, null, (ObjectNode) element));
@ -858,7 +858,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
final int minimalSize, final boolean closed, JsonNode node)
throws DeserializerException, EdmPrimitiveTypeException {
if (node.isArray()) {
List<Point> points = new ArrayList<Point>();
List<Point> points = new ArrayList<>();
for (final JsonNode element : node) {
points.add(readGeoPointValue(name, dimension, element, null));
}
@ -914,7 +914,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
}
private void removeAnnotations(final ObjectNode tree) throws DeserializerException {
List<String> toRemove = new ArrayList<String>();
List<String> toRemove = new ArrayList<>();
Iterator<Entry<String, JsonNode>> fieldsIterator = tree.fields();
while (fieldsIterator.hasNext()) {
Map.Entry<String, JsonNode> field = fieldsIterator.next();
@ -1040,7 +1040,7 @@ public class ODataJsonDeserializer implements ODataDeserializer {
@Override
public DeserializerResult entityReferences(final InputStream stream) throws DeserializerException {
try {
List<URI> parsedValues = new ArrayList<URI>();
List<URI> parsedValues = new ArrayList<>();
final ObjectNode tree = parseJsonTree(stream);
final String key = constants.getId();
JsonNode jsonNode = tree.get(Constants.VALUE);

View File

@ -53,7 +53,7 @@ public class ETagParser {
return Collections.<String> emptySet();
}
Set<String> result = new HashSet<String>();
Set<String> result = new HashSet<>();
for (final String value : values) {
final Collection<String> part = parse(value);
if (part.size() == 1 && "*".equals(part.iterator().next())) {
@ -69,7 +69,7 @@ public class ETagParser {
if ("*".equals(value.trim())) {
return Collections.singleton("*");
} else {
Set<String> result = new HashSet<String>();
Set<String> result = new HashSet<>();
String separator = "";
int start = 0;
Matcher matcher = ETAG.matcher(value.trim());

View File

@ -68,7 +68,7 @@ public class PreferParser {
return Collections.emptyMap();
}
Map<String, Preference> result = new HashMap<String, Preference>();
Map<String, Preference> result = new HashMap<>();
for (final String value : values) {
if (value != null && !value.isEmpty()) {
parse(value, result);
@ -78,7 +78,7 @@ public class PreferParser {
}
private static void parse(final String value, final Map<String, Preference> result) {
Map<String, Preference> partResult = new HashMap<String, Preference>();
Map<String, Preference> partResult = new HashMap<>();
String separator = "";
int start = 0;
Matcher matcher = PREFERENCE.matcher(value.trim());
@ -115,7 +115,7 @@ public class PreferParser {
}
private static Map<String, String> parseParameters(final String parameters) {
Map<String, String> result = new HashMap<String, String>();
Map<String, String> result = new HashMap<>();
String separator = "";
int start = 0;
Matcher matcher = PARAMETER.matcher(parameters.trim());

View File

@ -133,7 +133,7 @@ public class JsonDeltaSerializer implements EdmDeltaSerializer {
.getEntitySetOrSingletonOrType(), json);
}
for (final DeletedEntity deletedEntity : entitySet.getDeletedEntities()) {
writeDeletedEntity(deletedEntity, options, json);
writeDeletedEntity(deletedEntity, json);
}
for (final DeltaLink addedLink : entitySet.getAddedLinks()) {
writeLink(addedLink, options, json, true);
@ -180,8 +180,8 @@ public class JsonDeltaSerializer implements EdmDeltaSerializer {
}
}
private void writeDeletedEntity(DeletedEntity deletedEntity,
EntityCollectionSerializerOptions options, JsonGenerator json) throws IOException, SerializerException {
private void writeDeletedEntity(DeletedEntity deletedEntity,
JsonGenerator json) throws IOException, SerializerException {
if (deletedEntity.getId() == null) {
throw new SerializerException("Entity id is null.", SerializerException.MessageKeys.MISSING_ID);
}
@ -454,7 +454,7 @@ public class JsonDeltaSerializer implements EdmDeltaSerializer {
final SelectOption select, final JsonGenerator json)
throws IOException, SerializerException {
final boolean all = ExpandSelectHelper.isAll(select);
final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select
final Set<String> selected = all ? new HashSet<>() : ExpandSelectHelper.getSelectedPropertyNames(select
.getSelectItems());
for (final String propertyName : type.getPropertyNames()) {
if (all || selected.contains(propertyName)) {

View File

@ -490,7 +490,7 @@ public class JsonDeltaSerializerWithNavigations implements EdmDeltaSerializer {
final SelectOption select, final JsonGenerator json)
throws IOException, SerializerException {
final boolean all = ExpandSelectHelper.isAll(select);
final Set<String> selected = all ? new HashSet<String>() : ExpandSelectHelper.getSelectedPropertyNames(select
final Set<String> selected = all ? new HashSet<>() : ExpandSelectHelper.getSelectedPropertyNames(select
.getSelectItems());
for (final String propertyName : type.getPropertyNames()) {
if ((all || selected.contains(propertyName)) && !properties.isEmpty()) {
@ -509,7 +509,7 @@ public class JsonDeltaSerializerWithNavigations implements EdmDeltaSerializer {
throws SerializerException, IOException {
if (ExpandSelectHelper.hasExpand(expand)) {
final boolean expandAll = ExpandSelectHelper.getExpandAll(expand) != null;
final Set<String> expanded = expandAll ? new HashSet<String>() : ExpandSelectHelper.getExpandedPropertyNames(
final Set<String> expanded = expandAll ? new HashSet<>() : ExpandSelectHelper.getExpandedPropertyNames(
expand.getExpandItems());
for (final String propertyName : type.getNavigationPropertyNames()) {
if (expandAll || expanded.contains(propertyName)) {

View File

@ -86,7 +86,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
public class MetadataDocumentJsonSerializer {
private final ServiceMetadata serviceMetadata;
private final Map<String, String> namespaceToAlias = new HashMap<String, String>();
private final Map<String, String> namespaceToAlias = new HashMap<>();
private static final String DOLLAR = "$";
private static final String VERSION = DOLLAR + "Version";
private static final String REFERENCES = DOLLAR + "Reference";
@ -197,13 +197,13 @@ public class MetadataDocumentJsonSerializer {
private void appendAnnotationGroups(final JsonGenerator json,
final List<EdmAnnotations> annotationGroups) throws SerializerException, IOException {
if (annotationGroups.size() > 0) {
if (!annotationGroups.isEmpty()) {
json.writeObjectFieldStart(ANNOTATION);
}
for (EdmAnnotations annotationGroup : annotationGroups) {
appendAnnotationGroup(json, annotationGroup);
}
if (annotationGroups.size() > 0) {
if (!annotationGroups.isEmpty()) {
json.writeEndObject();
}
}
@ -345,7 +345,7 @@ public class MetadataDocumentJsonSerializer {
private void appendNavigationPropertyBindings(final JsonGenerator json,
final EdmBindingTarget bindingTarget) throws SerializerException, IOException {
if (bindingTarget.getNavigationPropertyBindings() != null &&
bindingTarget.getNavigationPropertyBindings().size() > 0) {
!bindingTarget.getNavigationPropertyBindings().isEmpty()) {
json.writeObjectFieldStart(NAVIGATION_PROPERTY_BINDING);
for (EdmNavigationPropertyBinding binding : bindingTarget.getNavigationPropertyBindings()) {
json.writeStringField(binding.getPath(), binding.getTarget());
@ -409,14 +409,14 @@ public class MetadataDocumentJsonSerializer {
private void appendFunctions(final JsonGenerator json,
final List<EdmFunction> functions) throws SerializerException, IOException {
Map<String, List<EdmFunction>> functionsMap = new HashMap<String, List<EdmFunction>>();
Map<String, List<EdmFunction>> functionsMap = new HashMap<>();
for (EdmFunction function : functions) {
if (functionsMap.containsKey(function.getName())) {
List<EdmFunction> actionsWithSpecificActionName = functionsMap.get(function.getName());
actionsWithSpecificActionName.add(function);
functionsMap.put(function.getName(), actionsWithSpecificActionName);
} else {
List<EdmFunction> functionList = new ArrayList<EdmFunction>();
List<EdmFunction> functionList = new ArrayList<>();
functionList.add(function);
functionsMap.put(function.getName(), functionList);
}
@ -453,14 +453,14 @@ public class MetadataDocumentJsonSerializer {
private void appendActions(final JsonGenerator json,
final List<EdmAction> actions) throws SerializerException, IOException {
Map<String, List<EdmAction>> actionsMap = new HashMap<String, List<EdmAction>>();
Map<String, List<EdmAction>> actionsMap = new HashMap<>();
for (EdmAction action : actions) {
if (actionsMap.containsKey(action.getName())) {
List<EdmAction> actionsWithSpecificActionName = actionsMap.get(action.getName());
actionsWithSpecificActionName.add(action);
actionsMap.put(action.getName(), actionsWithSpecificActionName);
} else {
List<EdmAction> actionList = new ArrayList<EdmAction>();
List<EdmAction> actionList = new ArrayList<>();
actionList.add(action);
actionsMap.put(action.getName(), actionList);
}
@ -626,7 +626,7 @@ public class MetadataDocumentJsonSerializer {
private void appendNavigationProperties(final JsonGenerator json,
final EdmStructuredType type) throws SerializerException, IOException {
List<String> navigationPropertyNames = new ArrayList<String>(type.getNavigationPropertyNames());
List<String> navigationPropertyNames = new ArrayList<>(type.getNavigationPropertyNames());
if (type.getBaseType() != null) {
navigationPropertyNames.removeAll(type.getBaseType().getNavigationPropertyNames());
}
@ -672,7 +672,7 @@ public class MetadataDocumentJsonSerializer {
private void appendProperties(final JsonGenerator json,
final EdmStructuredType type) throws SerializerException, IOException {
List<String> propertyNames = new ArrayList<String>(type.getPropertyNames());
List<String> propertyNames = new ArrayList<>(type.getPropertyNames());
if (type.getBaseType() != null) {
propertyNames.removeAll(type.getBaseType().getPropertyNames());
}

View File

@ -100,7 +100,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
private static final Map<Geospatial.Type, String> geoValueTypeToJsonName;
static {
Map<Geospatial.Type, String> temp = new EnumMap<Geospatial.Type, String>(Geospatial.Type.class);
Map<Geospatial.Type, String> temp = new EnumMap<>(Geospatial.Type.class);
temp.put(Geospatial.Type.POINT, Constants.ELEM_POINT);
temp.put(Geospatial.Type.MULTIPOINT, Constants.ELEM_MULTIPOINT);
temp.put(Geospatial.Type.LINESTRING, Constants.ELEM_LINESTRING);
@ -382,7 +382,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
boolean cycle = false;
if (expand != null) {
if (ancestors == null) {
ancestors = new HashSet<String>();
ancestors = new HashSet<>();
}
cycle = !ancestors.add(getEntityId(entity, entityType, name));
}
@ -509,7 +509,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
final SelectOption select, final JsonGenerator json, Linked linked, ExpandOption expand)
throws IOException, SerializerException {
final boolean all = ExpandSelectHelper.isAll(select);
final Set<String> selected = all ? new HashSet<String>() :
final Set<String> selected = all ? new HashSet<>() :
ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems());
addKeyPropertiesToSelected(selected, type);
Set<List<String>> expandedPaths = ExpandSelectHelper.getExpandedItemsPath(expand);
@ -1189,11 +1189,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
json.close();
outputStream.close();
return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final IOException e) {
cachedException =
new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
throw cachedException;
} catch (DecoderException e) {
} catch (final IOException | DecoderException e) {
cachedException =
new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
throw cachedException;

View File

@ -44,7 +44,7 @@ public class CircleStreamBuffer {
private boolean writeClosed = false;
private boolean readClosed = false;
private Queue<ByteBuffer> bufferQueue = new LinkedBlockingQueue<ByteBuffer>();
private Queue<ByteBuffer> bufferQueue = new LinkedBlockingQueue<>();
private ByteBuffer currentWriteBuffer;
private final InternalInputStream inStream;

View File

@ -170,7 +170,7 @@ public final class ContextURLHelper {
} else {
List<List<String>> complexSelectedPaths = edmProperty != null &&
edmProperty.getType() instanceof EdmComplexType ?
getComplexSelectedPaths(edmProperty, selectedPaths) : new ArrayList<List<String>>();
getComplexSelectedPaths(edmProperty, selectedPaths) : new ArrayList<>();
if (complexSelectedPaths.isEmpty()) {
for (List<String> path : selectedPaths) {
complexSelectedPaths.add(path);
@ -319,7 +319,7 @@ public final class ContextURLHelper {
}
private static List<String> getPropertyPath(final List<UriResource> path) {
List<String> result = new LinkedList<String>();
List<String> result = new LinkedList<>();
int index = 1;
while (index < path.size() && path.get(index) instanceof UriResourceProperty) {
result.add(((UriResourceProperty) path.get(index)).getProperty().getName());
@ -338,9 +338,9 @@ public final class ContextURLHelper {
private static List<List<String>> getComplexSelectedPaths(final EdmProperty edmProperty,
final Set<List<String>> selectedPaths) {
List<List<String>> result = new ArrayList<List<String>>();
List<List<String>> result = new ArrayList<>();
if (selectedPaths == null) {
List<String> path = new LinkedList<String>();
List<String> path = new LinkedList<>();
path.add(edmProperty.getName());
result.add(path);
} else {
@ -371,8 +371,8 @@ public final class ContextURLHelper {
}
private static List<List<String>> getComplexSelectedPaths(EdmNavigationProperty edmProperty) {
List<List<String>> result = new ArrayList<List<String>>();
List<String> path = new LinkedList<String>();
List<List<String>> result = new ArrayList<>();
List<String> path = new LinkedList<>();
path.add(edmProperty.getName());
result.add(path);
return result;

View File

@ -59,7 +59,7 @@ public abstract class ExpandSelectHelper {
}
public static Set<String> getSelectedPropertyNames(final List<SelectItem> selectItems) {
Set<String> selected = new HashSet<String>();
Set<String> selected = new HashSet<>();
for (final SelectItem item : selectItems) {
final UriResource resource = item.getResourcePath().getUriResourceParts().get(0);
if (resource instanceof UriResourceProperty) {
@ -84,13 +84,13 @@ public abstract class ExpandSelectHelper {
*/
public static Set<List<String>> getSelectedPathsWithTypeCasts(
final List<SelectItem> selectItems, final String propertyName) {
Set<List<String>> selectedPaths = new HashSet<List<String>>();
Set<List<String>> selectedPaths = new HashSet<>();
for (final SelectItem item : selectItems) {
final List<UriResource> parts = item.getResourcePath().getUriResourceParts();
final UriResource resource = parts.get(0);
if (resource instanceof UriResourceProperty
&& propertyName.equals(((UriResourceProperty) resource).getProperty().getName())) {
List<String> path = new ArrayList<String>();
List<String> path = new ArrayList<>();
if (item.getStartTypeFilter() != null) {
path.add(item.getStartTypeFilter().getFullQualifiedName().getFullQualifiedNameAsString());
}
@ -106,7 +106,7 @@ public abstract class ExpandSelectHelper {
extractPathsFromResourceParts(selectedPaths, parts, path);
} else if (resource instanceof UriResourceNavigation
&& propertyName.equals(((UriResourceNavigation) resource).getProperty().getName()) ) {
List<String> path = new ArrayList<String>();
List<String> path = new ArrayList<>();
if (item.getStartTypeFilter() != null) {
path.add(item.getStartTypeFilter().getFullQualifiedName().getFullQualifiedNameAsString());
}
@ -147,14 +147,14 @@ public abstract class ExpandSelectHelper {
}
public static Set<List<String>> getSelectedPaths(final List<SelectItem> selectItems, final String propertyName) {
Set<List<String>> selectedPaths = new HashSet<List<String>>();
Set<List<String>> selectedPaths = new HashSet<>();
for (final SelectItem item : selectItems) {
final List<UriResource> parts = item.getResourcePath().getUriResourceParts();
final UriResource resource = parts.get(0);
if (resource instanceof UriResourceProperty
&& propertyName.equals(((UriResourceProperty) resource).getProperty().getName())) {
if (parts.size() > 1) {
List<String> path = new ArrayList<String>();
List<String> path = new ArrayList<>();
for (final UriResource part : parts.subList(1, parts.size())) {
if (part instanceof UriResourceProperty) {
path.add(((UriResourceProperty) part).getProperty().getName());
@ -172,13 +172,13 @@ public abstract class ExpandSelectHelper {
}
public static Set<List<String>> getSelectedPaths(final List<SelectItem> selectItems) {
Set<List<String>> selectedPaths = new HashSet<List<String>>();
Set<List<String>> selectedPaths = new HashSet<>();
for (final SelectItem item : selectItems) {
final List<UriResource> parts = item.getResourcePath().getUriResourceParts();
final UriResource resource = parts.get(0);
if (resource instanceof UriResourceProperty) {
if (!parts.isEmpty()) {
List<String> path = new ArrayList<String>();
List<String> path = new ArrayList<>();
for (final UriResource part : parts.subList(0, parts.size())) {
if (part instanceof UriResourceProperty) {
path.add(((UriResourceProperty) part).getProperty().getName());
@ -204,7 +204,7 @@ public abstract class ExpandSelectHelper {
public static Set<List<String>> getReducedSelectedPaths(final Set<List<String>> selectedPaths,
final String propertyName) {
Set<List<String>> reducedPaths = new HashSet<List<String>>();
Set<List<String>> reducedPaths = new HashSet<>();
for (final List<String> path : selectedPaths) {
if (propertyName.equals(path.get(0))) {
if (path.size() > 1) {
@ -232,7 +232,7 @@ public abstract class ExpandSelectHelper {
public static Set<String> getExpandedPropertyNames(final List<ExpandItem> expandItems)
throws SerializerException {
Set<String> expanded = new HashSet<String>();
Set<String> expanded = new HashSet<>();
for (final ExpandItem item : expandItems) {
final List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts();
final UriResource resource = resourceParts.get(0);
@ -267,7 +267,7 @@ public abstract class ExpandSelectHelper {
}
public static Set<List<String>> getExpandedItemsPath(ExpandOption expand) {
Set<List<String>> expandPaths = new HashSet<List<String>>();
Set<List<String>> expandPaths = new HashSet<>();
if (expand != null) {
List<ExpandItem> expandItems = expand.getExpandItems();
for (ExpandItem item : expandItems) {
@ -276,7 +276,7 @@ public abstract class ExpandSelectHelper {
}
List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts();
if (resourceParts.get(0) instanceof UriResourceComplexProperty) {
List<String> path = new ArrayList<String>();
List<String> path = new ArrayList<>();
for (UriResource resource : resourceParts) {
if (resource instanceof UriResourceNavigation) {
path.add(((UriResourceNavigation) resource).getProperty().getName());
@ -293,7 +293,7 @@ public abstract class ExpandSelectHelper {
public static Set<List<String>> getReducedExpandItemsPaths(final Set<List<String>> expandItemsPaths,
final String propertyName) {
Set<List<String>> reducedPaths = new HashSet<List<String>>();
Set<List<String>> reducedPaths = new HashSet<>();
for (final List<String> path : expandItemsPaths) {
if (propertyName.equals(path.get(0))) {
if (path.size() > 1) {

View File

@ -156,7 +156,7 @@ public class MetadataDocumentXmlSerializer {
private static final String XML_APPLIES_TO = "AppliesTo";
private final ServiceMetadata serviceMetadata;
private final Map<String, String> namespaceToAlias = new HashMap<String, String>();
private final Map<String, String> namespaceToAlias = new HashMap<>();
public MetadataDocumentXmlSerializer(final ServiceMetadata serviceMetadata) throws SerializerException {
if (serviceMetadata == null || serviceMetadata.getEdm() == null) {
@ -832,7 +832,7 @@ public class MetadataDocumentXmlSerializer {
private void appendNavigationProperties(final XMLStreamWriter writer, final EdmStructuredType type)
throws XMLStreamException {
List<String> navigationPropertyNames = new ArrayList<String>(type.getNavigationPropertyNames());
List<String> navigationPropertyNames = new ArrayList<>(type.getNavigationPropertyNames());
if (type.getBaseType() != null) {
navigationPropertyNames.removeAll(type.getBaseType().getNavigationPropertyNames());
}
@ -873,7 +873,7 @@ public class MetadataDocumentXmlSerializer {
}
private void appendProperties(final XMLStreamWriter writer, final EdmStructuredType type) throws XMLStreamException {
List<String> propertyNames = new ArrayList<String>(type.getPropertyNames());
List<String> propertyNames = new ArrayList<>(type.getPropertyNames());
if (type.getBaseType() != null) {
propertyNames.removeAll(type.getBaseType().getPropertyNames());
}

View File

@ -110,11 +110,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
outputStream.close();
return SerializerResultImpl.with().content(buffer.getInputStream()).build();
} catch (final XMLStreamException e) {
cachedException =
new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
throw cachedException;
} catch (IOException e) {
} catch (final XMLStreamException | IOException e) {
cachedException =
new SerializerException(IO_EXCEPTION_TEXT, e, SerializerException.MessageKeys.IO_EXCEPTION);
throw cachedException;

View File

@ -61,17 +61,17 @@ public class UriInfoImpl implements UriInfo {
private UriInfoKind kind;
// for $entity
private List<String> entitySetNames = new ArrayList<String>();
private List<String> entitySetNames = new ArrayList<>();
// for $entity
private EdmEntityType entityTypeCast;
private UriResource lastResourcePart;
private List<UriResource> pathParts = new ArrayList<UriResource>();
private List<UriResource> pathParts = new ArrayList<>();
private Map<SystemQueryOptionKind, SystemQueryOption> systemQueryOptions =
new EnumMap<SystemQueryOptionKind, SystemQueryOption>(SystemQueryOptionKind.class);
private Map<String, AliasQueryOption> aliases = new HashMap<String, AliasQueryOption>();
private List<CustomQueryOption> customQueryOptions = new ArrayList<CustomQueryOption>();
new EnumMap<>(SystemQueryOptionKind.class);
private Map<String, AliasQueryOption> aliases = new HashMap<>();
private List<CustomQueryOption> customQueryOptions = new ArrayList<>();
private String fragment;

View File

@ -89,7 +89,7 @@ public class ApplyParser {
private static final Map<TokenKind, StandardMethod> TOKEN_KIND_TO_STANDARD_METHOD;
static {
Map<TokenKind, StandardMethod> temp = new EnumMap<TokenKind, StandardMethod>(TokenKind.class);
Map<TokenKind, StandardMethod> temp = new EnumMap<>(TokenKind.class);
temp.put(TokenKind.SUM, StandardMethod.SUM);
temp.put(TokenKind.MIN, StandardMethod.MIN);
temp.put(TokenKind.MAX, StandardMethod.MAX);
@ -100,7 +100,7 @@ public class ApplyParser {
private static final Map<TokenKind, BottomTop.Method> TOKEN_KIND_TO_BOTTOM_TOP_METHOD;
static {
Map<TokenKind, BottomTop.Method> temp = new EnumMap<TokenKind, BottomTop.Method>(TokenKind.class);
Map<TokenKind, BottomTop.Method> temp = new EnumMap<>(TokenKind.class);
temp.put(TokenKind.BottomCountTrafo, BottomTop.Method.BOTTOM_COUNT);
temp.put(TokenKind.BottomPercentTrafo, BottomTop.Method.BOTTOM_PERCENT);
temp.put(TokenKind.BottomSumTrafo, BottomTop.Method.BOTTOM_SUM);

View File

@ -97,7 +97,7 @@ import org.apache.olingo.server.core.uri.validator.UriValidationException;
public class ExpressionParser {
private static final Map<TokenKind, BinaryOperatorKind> tokenToBinaryOperator;
static {
Map<TokenKind, BinaryOperatorKind> temp = new EnumMap<TokenKind, BinaryOperatorKind>(TokenKind.class);
Map<TokenKind, BinaryOperatorKind> temp = new EnumMap<>(TokenKind.class);
temp.put(TokenKind.OrOperator, BinaryOperatorKind.OR);
temp.put(TokenKind.AndOperator, BinaryOperatorKind.AND);
@ -122,7 +122,7 @@ public class ExpressionParser {
// 'cast' and 'isof' are handled specially.
private static final Map<TokenKind, MethodKind> tokenToMethod;
static {
Map<TokenKind, MethodKind> temp = new EnumMap<TokenKind, MethodKind>(TokenKind.class);
Map<TokenKind, MethodKind> temp = new EnumMap<>(TokenKind.class);
temp.put(TokenKind.CeilingMethod, MethodKind.CEILING);
temp.put(TokenKind.ConcatMethod, MethodKind.CONCAT);
temp.put(TokenKind.ContainsMethod, MethodKind.CONTAINS);
@ -162,7 +162,7 @@ public class ExpressionParser {
private final OData odata;
private UriTokenizer tokenizer;
private Deque<UriResourceLambdaVariable> lambdaVariables = new ArrayDeque<UriResourceLambdaVariable>();
private Deque<UriResourceLambdaVariable> lambdaVariables = new ArrayDeque<>();
private EdmType referringType;
private Collection<String> crossjoinEntitySetNames;
private Map<String, AliasQueryOption> aliases;
@ -254,7 +254,7 @@ public class ExpressionParser {
private Expression parseIsOfOrCastMethod(final MethodKind kind) throws UriParserException, UriValidationException {
// The TokenKind 'IsOfMethod' consumes also the opening parenthesis.
// The first parameter could be an expression or a type literal.
List<Expression> parameters = new ArrayList<Expression>();
List<Expression> parameters = new ArrayList<>();
ParserHelper.bws(tokenizer);
parameters.add(parseExpression());
if (!(parameters.get(0) instanceof TypeLiteral)) {
@ -377,7 +377,7 @@ public class ExpressionParser {
* @throws UriValidationException
*/
private List<Expression> parseInExpr() throws UriParserException, UriValidationException {
List<Expression> expressionList = new ArrayList<Expression>();
List<Expression> expressionList = new ArrayList<>();
while(!tokenizer.next(TokenKind.CLOSE)) {
Expression expression = parseExpression();
expressionList.add(expression);
@ -496,7 +496,7 @@ public class ExpressionParser {
private List<Expression> parseMethodParameters(final MethodKind methodKind)
throws UriParserException, UriValidationException {
List<Expression> parameters = new ArrayList<Expression>();
List<Expression> parameters = new ArrayList<>();
switch (methodKind) {
// Must have no parameter.
case NOW:

View File

@ -65,7 +65,7 @@ public class ParserHelper {
protected static final Map<TokenKind, EdmPrimitiveTypeKind> tokenToPrimitiveType;
static {
/* Enum and null are not present in the map. These have to be handled differently. */
Map<TokenKind, EdmPrimitiveTypeKind> temp = new EnumMap<TokenKind, EdmPrimitiveTypeKind>(TokenKind.class);
Map<TokenKind, EdmPrimitiveTypeKind> temp = new EnumMap<>(TokenKind.class);
temp.put(TokenKind.BooleanValue, EdmPrimitiveTypeKind.Boolean);
temp.put(TokenKind.StringValue, EdmPrimitiveTypeKind.String);
// Very large integer values are of type Edm.Decimal but this is handled elsewhere.
@ -163,8 +163,8 @@ public class ParserHelper {
final Edm edm, final EdmType referringType, final boolean withComplex,
final Map<String, AliasQueryOption> aliases)
throws UriParserException, UriValidationException {
List<UriParameter> parameters = new ArrayList<UriParameter>();
Set<String> parameterNames = new HashSet<String>();
List<UriParameter> parameters = new ArrayList<>();
Set<String> parameterNames = new HashSet<>();
ParserHelper.requireNext(tokenizer, TokenKind.OPEN);
if (tokenizer.next(TokenKind.CLOSE)) {
return parameters;
@ -255,7 +255,7 @@ public class ParserHelper {
// The alias value is not an allowed literal value, so parse it again as expression.
aliasTokenizer = new UriTokenizer(alias.getText());
// Don't pass on the current alias to avoid circular references.
Map<String, AliasQueryOption> aliasesInner = new HashMap<String, AliasQueryOption>(aliases);
Map<String, AliasQueryOption> aliasesInner = new HashMap<>(aliases);
aliasesInner.remove(name);
final Expression expression = new ExpressionParser(edm, odata)
.parse(aliasTokenizer, referringType, null, aliasesInner);
@ -299,8 +299,8 @@ public class ParserHelper {
UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
Integer.toString(keyPropertyRefs.size()), "0");
}
List<UriParameter> keys = new ArrayList<UriParameter>();
Map<String, String> referencedNames = new HashMap<String, String>();
List<UriParameter> keys = new ArrayList<>();
Map<String, String> referencedNames = new HashMap<>();
if (partner != null) {
// Prepare list of potentially missing keys to be filled from referential constraints.
@ -378,8 +378,8 @@ public class ParserHelper {
final Edm edm, final EdmType referringType, final Map<String, AliasQueryOption> aliases)
throws UriParserException, UriValidationException {
List<UriParameter> parameters = new ArrayList<UriParameter>();
List<String> parameterNames = new ArrayList<String>();
List<UriParameter> parameters = new ArrayList<>();
List<String> parameterNames = new ArrayList<>();
// To validate that each key predicate is exactly specified once, we use a list to pick from.
List<String> remainingKeyNames = new ArrayList<String>(edmEntityType.getKeyPredicateNames());
@ -530,7 +530,7 @@ public class ParserHelper {
}
protected static List<String> getParameterNames(final List<UriParameter> parameters) {
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
for (final UriParameter parameter : parameters) {
names.add(parameter.getName());
}

View File

@ -124,7 +124,7 @@ public class ResourcePathParser {
ParserHelper.requireNext(tokenizer, TokenKind.CROSSJOIN);
ParserHelper.requireNext(tokenizer, TokenKind.OPEN);
// At least one entity-set name is mandatory. Try to fetch all.
List<String> entitySetNames = new ArrayList<String>();
List<String> entitySetNames = new ArrayList<>();
do {
ParserHelper.requireNext(tokenizer, TokenKind.ODataIdentifier);
final String name = tokenizer.getText();

View File

@ -55,7 +55,7 @@ public class SelectParser {
public SelectOption parse(UriTokenizer tokenizer, final EdmStructuredType referencedType,
final boolean referencedIsCollection) throws UriParserException, UriValidationException {
List<SelectItem> selectItems = new ArrayList<SelectItem>();
List<SelectItem> selectItems = new ArrayList<>();
SelectItem item;
do {
item = parseItem(tokenizer, referencedType, referencedIsCollection);
@ -170,7 +170,7 @@ public class SelectParser {
}
private List<String> parseFunctionParameterNames(UriTokenizer tokenizer) throws UriParserException {
List<String> names = new ArrayList<String>();
List<String> names = new ArrayList<>();
if (tokenizer.next(TokenKind.OPEN)) {
do {
ParserHelper.requireNext(tokenizer, TokenKind.ODataIdentifier);

View File

@ -37,7 +37,7 @@ public class UriDecoder {
/** Splits the path string at '/' characters and percent-decodes the resulting path segments. */
protected static List<String> splitAndDecodePath(final String path) throws UriParserSyntaxException {
List<String> pathSegmentsDecoded = new ArrayList<String>();
List<String> pathSegmentsDecoded = new ArrayList<>();
for (final String segment : split(path, '/')) {
pathSegmentsDecoded.add(decode(segment));
}
@ -51,7 +51,7 @@ public class UriDecoder {
*/
protected static List<QueryOption> splitAndDecodeOptions(final String queryOptionString)
throws UriParserSyntaxException {
List<QueryOption> queryOptions = new ArrayList<QueryOption>();
List<QueryOption> queryOptions = new ArrayList<>();
formEncoding = false;
for (final String option : split(queryOptionString, '&')) {
final int pos = option.indexOf('=');
@ -75,7 +75,7 @@ public class UriDecoder {
* @return list of elements (can be empty)
*/
private static List<String> split(final String input, final char c) {
List<String> list = new LinkedList<String>();
List<String> list = new LinkedList<>();
int start = 0;
int end;

View File

@ -617,7 +617,7 @@ public class SearchTokenizer {
char[] chars = searchQuery.trim().toCharArray();
State state = new SearchExpressionState();
List<SearchQueryToken> states = new ArrayList<SearchQueryToken>();
List<SearchQueryToken> states = new ArrayList<>();
for (char aChar : chars) {
State next = state.nextChar(aChar);
if (state.isFinished()) {

View File

@ -28,7 +28,7 @@ import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOption {
private final List<ExpandItem> expandItems = new ArrayList<ExpandItem>();
private final List<ExpandItem> expandItems = new ArrayList<>();
public ExpandOptionImpl() {
setKind(SystemQueryOptionKind.EXPAND);

View File

@ -28,7 +28,7 @@ import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
public class OrderByOptionImpl extends SystemQueryOptionImpl implements OrderByOption {
private List<OrderByItem> orders = new ArrayList<OrderByItem>();
private List<OrderByItem> orders = new ArrayList<>();
public OrderByOptionImpl() {
setKind(SystemQueryOptionKind.ORDERBY);

View File

@ -39,7 +39,7 @@ public class AggregateExpressionImpl implements AggregateExpression {
private FullQualifiedName customMethod;
private String alias;
private AggregateExpression inlineAggregateExpression;
private List<AggregateExpression> from = new ArrayList<AggregateExpression>();
private List<AggregateExpression> from = new ArrayList<>();
@Override
public List<UriResource> getPath() {

View File

@ -29,7 +29,7 @@ import org.apache.olingo.server.api.uri.queryoption.apply.AggregateExpression;
*/
public class AggregateImpl implements Aggregate {
private List<AggregateExpression> expressions = new ArrayList<AggregateExpression>();
private List<AggregateExpression> expressions = new ArrayList<>();
@Override
public Kind getKind() {

View File

@ -29,7 +29,7 @@ import org.apache.olingo.server.api.uri.queryoption.apply.ComputeExpression;
*/
public class ComputeImpl implements Compute {
private List<ComputeExpression> expressions = new ArrayList<ComputeExpression>();
private List<ComputeExpression> expressions = new ArrayList<>();
@Override
public Kind getKind() {

View File

@ -29,7 +29,7 @@ import org.apache.olingo.server.api.uri.queryoption.apply.Concat;
*/
public class ConcatImpl implements Concat {
private List<ApplyOption> options = new ArrayList<ApplyOption>();
private List<ApplyOption> options = new ArrayList<>();
@Override
public Kind getKind() {

View File

@ -46,7 +46,7 @@ public class DynamicStructuredType implements EdmStructuredType, Cloneable {
public DynamicStructuredType addProperty(final EdmProperty property) {
if (properties == null) {
properties = new LinkedHashMap<String, EdmProperty>();
properties = new LinkedHashMap<>();
}
properties.put(property.getName(), property);
return this;
@ -65,7 +65,7 @@ public class DynamicStructuredType implements EdmStructuredType, Cloneable {
if (properties == null || properties.isEmpty()) {
return startType.getPropertyNames();
} else {
List<String> names = new ArrayList<String>(startType.getPropertyNames());
List<String> names = new ArrayList<>(startType.getPropertyNames());
names.addAll(properties.keySet());
return Collections.unmodifiableList(names);
}

View File

@ -31,7 +31,7 @@ import org.apache.olingo.server.api.uri.queryoption.apply.GroupByItem;
public class GroupByImpl implements GroupBy {
private ApplyOption applyOption;
private List<GroupByItem> groupByItems = new ArrayList<GroupByItem>();
private List<GroupByItem> groupByItems = new ArrayList<>();
@Override
public Kind getKind() {

View File

@ -33,7 +33,7 @@ public class GroupByItemImpl implements GroupByItem {
private UriInfo path;
private boolean isRollupAll;
private List<GroupByItem> rollup = new ArrayList<GroupByItem>();
private List<GroupByItem> rollup = new ArrayList<>();
@Override
public List<UriResource> getPath() {

View File

@ -81,7 +81,7 @@ public class BinaryImpl implements Binary {
T localRight = this.right.accept(visitor);
return visitor.visitBinaryOperator(operator, localLeft, localRight);
} else if (this.expressions != null) {
List<T> expressions = new ArrayList<T>();
List<T> expressions = new ArrayList<>();
for (final Expression expression : this.expressions) {
expressions.add(expression.accept(visitor));
}

View File

@ -125,7 +125,7 @@ public class MethodImpl implements Method {
@Override
public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
List<T> userParameters = new ArrayList<T>();
List<T> userParameters = new ArrayList<>();
if (parameters != null) {
for (final Expression parameter : parameters) {
userParameters.add(parameter.accept(visitor));

View File

@ -106,7 +106,7 @@ public class UriValidator {
private static final Map<SystemQueryOptionKind, Integer> OPTION_INDEX;
static {
Map<SystemQueryOptionKind, Integer> temp =
new EnumMap<SystemQueryOptionKind, Integer>(SystemQueryOptionKind.class);
new EnumMap<>(SystemQueryOptionKind.class);
temp.put(SystemQueryOptionKind.FILTER, 0);
temp.put(SystemQueryOptionKind.FORMAT, 1);
temp.put(SystemQueryOptionKind.EXPAND, 2);