[OLINGO-659] Renamed setter/getter to fit code conventions

This commit is contained in:
Michael Bolz 2015-09-17 09:18:24 +02:00
parent 547cd0a79e
commit 87f829e5ae
10 changed files with 27 additions and 27 deletions

View File

@ -30,7 +30,7 @@ public class EntityCollectionSerializerOptions {
private CountOption count;
private ExpandOption expand;
private SelectOption select;
private boolean onlyReferences;
private boolean writeOnlyReferences;
private String id;
/** Gets the {@link ContextURL}. */
@ -54,8 +54,8 @@ public class EntityCollectionSerializerOptions {
}
/** only writes the references of the entities */
public boolean onlyReferences() {
return onlyReferences;
public boolean getWriteOnlyReferences() {
return writeOnlyReferences;
}
/** Gets the id of the entity collection */
@ -102,13 +102,13 @@ public class EntityCollectionSerializerOptions {
}
/** Sets to serialize only references */
public Builder setWriteOnlyReferences(final boolean ref) {
options.onlyReferences = ref;
public Builder writeOnlyReferences(final boolean ref) {
options.writeOnlyReferences = ref;
return this;
}
/** Sets id of the collection */
public Builder setId(final String id) {
public Builder id(final String id) {
options.id = id;
return this;
}

View File

@ -27,7 +27,7 @@ public class EntitySerializerOptions {
private ContextURL contextURL;
private ExpandOption expand;
private SelectOption select;
private boolean onlyReferences;
private boolean writeOnlyReferences;
/** Gets the {@link ContextURL}. */
public ContextURL getContextURL() {
@ -45,8 +45,8 @@ public class EntitySerializerOptions {
}
/** only writes the references of the entities */
public boolean onlyReferences() {
return onlyReferences;
public boolean getWriteOnlyReferences() {
return writeOnlyReferences;
}
private EntitySerializerOptions() {}
@ -84,8 +84,8 @@ public class EntitySerializerOptions {
}
/** Sets to serialize only references */
public Builder setWriteOnlyReferences(final boolean ref) {
options.onlyReferences = ref;
public Builder writeOnlyReferences(final boolean ref) {
options.writeOnlyReferences = ref;
return this;
}

View File

@ -147,13 +147,13 @@ public abstract class ServiceRequest {
return (T) EntitySerializerOptions.with()
.contextURL(isODataMetadataNone(getResponseContentType()) ? null : contextUrl)
.expand(uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption())
.setWriteOnlyReferences(references).build();
.writeOnlyReferences(references).build();
} else if (serilizerOptions.isAssignableFrom(EntityCollectionSerializerOptions.class)) {
return (T) EntityCollectionSerializerOptions.with()
.contextURL(isODataMetadataNone(getResponseContentType()) ? null : contextUrl)
.count(uriInfo.getCountOption()).expand(uriInfo.getExpandOption())
.select(uriInfo.getSelectOption()).setWriteOnlyReferences(references)
.setId(getODataRequest().getRawBaseUri()+getODataRequest().getRawODataPath()).build();
.select(uriInfo.getSelectOption()).writeOnlyReferences(references)
.id(getODataRequest().getRawBaseUri() + getODataRequest().getRawODataPath()).build();
} else if (serilizerOptions.isAssignableFrom(ComplexSerializerOptions.class)) {
return (T) ComplexSerializerOptions.with().contextURL(contextUrl)
.expand(this.uriInfo.getExpandOption()).select(this.uriInfo.getSelectOption()).build();

View File

@ -157,7 +157,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
writeEntitySet(metadata, entityType, entitySet, null, null, false, json);
} else {
writeEntitySet(metadata, entityType, entitySet,
options.getExpand(), options.getSelect(), options.onlyReferences(), json);
options.getExpand(), options.getSelect(), options.getWriteOnlyReferences(), json);
}
writeNextLink(entitySet, json);
@ -186,7 +186,7 @@ public class ODataJsonSerializer extends AbstractODataSerializer {
writeEntity(metadata, entityType, entity, contextURL,
options == null ? null : options.getExpand(),
options == null ? null : options.getSelect(),
options == null ? false : options.onlyReferences(),
options == null ? false : options.getWriteOnlyReferences(),
json);
json.close();

View File

@ -213,7 +213,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
final EntityCollectionSerializerOptions options) throws SerializerException {
final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
if (options != null && options.onlyReferences()) {
if (options != null && options.getWriteOnlyReferences()) {
ReferenceCollectionSerializerOptions rso = ReferenceCollectionSerializerOptions.with()
.contextURL(contextURL).build();
return entityReferenceCollection(entitySet, rso);
@ -282,7 +282,7 @@ public class ODataXmlSerializer extends AbstractODataSerializer {
final Entity entity, final EntitySerializerOptions options) throws SerializerException {
final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
if (options != null && options.onlyReferences()) {
if (options != null && options.getWriteOnlyReferences()) {
return entityReference(entity,
ReferenceSerializerOptions.with().contextURL(contextURL).build());
}

View File

@ -536,7 +536,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
getContextUrl(request.getRawODataPath(), edmEntitySet, edmEntityType, false, expand, select))
.count(countOption)
.expand(expand).select(select)
.setId(id)
.id(id)
.build());
}

View File

@ -270,7 +270,7 @@ public class ODataXmlSerializerTest {
EntityCollectionSerializerOptions.with()
.contextURL(ContextURL.with().serviceRoot(new URI("http://host:port"))
.entitySet(edmEntitySet).build())
.setId("http://host/svc/ESCompAllPrim")
.id("http://host/svc/ESCompAllPrim")
.count(countOption)
.build()).getContent();
final String resultString = IOUtils.toString(result);
@ -635,7 +635,7 @@ public class ODataXmlSerializerTest {
edmEntitySet.getEntityType(), entitySet,
EntityCollectionSerializerOptions.with()
.contextURL(ContextURL.with().entitySet(edmEntitySet).build())
.setId("http://host/svc/ESMedia")
.id("http://host/svc/ESMedia")
.build()).getContent();
final String resultString = IOUtils.toString(content);
@ -732,7 +732,7 @@ public class ODataXmlSerializerTest {
EntityCollectionSerializerOptions.with()
.contextURL(ContextURL.with().serviceRoot(URI.create("http://host/svc"))
.entitySet(edmEntitySet).build())
.setId("http://host/svc/ESAllNullable")
.id("http://host/svc/ESAllNullable")
.build()).getContent();
final String resultString = IOUtils.toString(content);
String expected = "<?xml version='1.0' encoding='UTF-8'?>\n" +
@ -928,7 +928,7 @@ public class ODataXmlSerializerTest {
.contextURL(ContextURL.with().entitySet(edmEntitySet)
.selectList(helper.buildContextURLSelectList(entityType, null, select))
.build())
.setId("http://host/svc/ESCompComp")
.id("http://host/svc/ESCompComp")
.select(select)
.build()).getContent();
final String resultString = IOUtils.toString(result);
@ -1002,7 +1002,7 @@ public class ODataXmlSerializerTest {
.contextURL(ContextURL.with().entitySet(edmEntitySet)
.selectList(helper.buildContextURLSelectList(entityType, null, select))
.build())
.setId("http://host/svc/ESCompComp")
.id("http://host/svc/ESCompComp")
.select(select)
.build()).getContent();
final String resultString = IOUtils.toString(inputStream);

View File

@ -82,7 +82,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName();
EntityCollectionSerializerOptions opts =
EntityCollectionSerializerOptions.with().setId(id).contextURL(contextUrl).build();
EntityCollectionSerializerOptions.with().id(id).contextURL(contextUrl).build();
SerializerResult serializedContent = serializer.entityCollection(serviceMetadata, edmEntityType, entitySet, opts);
// Finally: configure the response object: set the body, headers and status code

View File

@ -136,7 +136,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName();
EntityCollectionSerializerOptions opts =
EntityCollectionSerializerOptions.with().setId(id).contextURL(contextUrl).build();
EntityCollectionSerializerOptions.with().id(id).contextURL(contextUrl).build();
SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType,
entityCollection, opts);
InputStream serializedContent = serializerResult.getContent();

View File

@ -124,7 +124,7 @@ public class DemoEntityCollectionProcessor implements EntityCollectionProcessor
final String id = request.getRawBaseUri() + "/" + edmEntitySet.getName();
EntityCollectionSerializerOptions opts = EntityCollectionSerializerOptions.with()
.contextURL(contextUrl).setId(id).build();
.contextURL(contextUrl).id(id).build();
SerializerResult serializerResult = serializer.entityCollection(serviceMetadata, edmEntityType, entityCollection,
opts);