Skip to content

Commit

Permalink
Remove final keyword on method arguments for Requests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Jan 11, 2017
1 parent 1054f40 commit 841f3a5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 57 deletions.
Expand Up @@ -28,7 +28,7 @@ public abstract class AbstractDownlinkRequest<T extends LwM2mResponse> implement

private final LwM2mPath path;

protected AbstractDownlinkRequest(final LwM2mPath path) {
protected AbstractDownlinkRequest(LwM2mPath path) {
Validate.notNull(path);
if (path.isRoot()) {
throw new IllegalArgumentException("downlink request cannot target root path: " + path.toString());
Expand Down
Expand Up @@ -32,7 +32,7 @@ public class BootstrapWriteRequest extends AbstractDownlinkRequest<BootstrapWrit
private final LwM2mNode node;
private final ContentFormat contentFormat;

public BootstrapWriteRequest(final LwM2mPath target, final LwM2mNode node, ContentFormat format) {
public BootstrapWriteRequest(LwM2mPath target, LwM2mNode node, ContentFormat format) {
super(target);
Validate.notNull(node);

Expand Down Expand Up @@ -93,7 +93,7 @@ public ContentFormat getContentFormat() {
}

@Override
public void accept(final DownlinkRequestVisitor visitor) {
public void accept(DownlinkRequestVisitor visitor) {
visitor.visit(this);
}

Expand Down
Expand Up @@ -30,7 +30,7 @@ public class DeleteRequest extends AbstractDownlinkRequest<DeleteResponse> {
* @param objectId the object type
* @param objectInstanceId the object instance
*/
public DeleteRequest(final int objectId, final int objectInstanceId) {
public DeleteRequest(int objectId, int objectInstanceId) {
this(new LwM2mPath(objectId, objectInstanceId));
}

Expand All @@ -40,17 +40,17 @@ public DeleteRequest(final int objectId, final int objectInstanceId) {
* @param path the path of the instance to delete
* @throw IllegalArgumentException if the path is not valid
*/
public DeleteRequest(final String path) {
public DeleteRequest(String path) {
super(new LwM2mPath(path));
}

private DeleteRequest(final LwM2mPath target) {
private DeleteRequest(LwM2mPath target) {
super(target);
Validate.isTrue(target.isObjectInstance(), "Only object instance can be delete.");
}

@Override
public void accept(final DownlinkRequestVisitor visitor) {
public void accept(DownlinkRequestVisitor visitor) {
visitor.visit(this);
}

Expand Down
Expand Up @@ -32,7 +32,7 @@ public class ExecuteRequest extends AbstractDownlinkRequest<ExecuteResponse> {
* @param path the path of the resource to execute
* @throw IllegalArgumentException if the path is not valid
*/
public ExecuteRequest(final String path) {
public ExecuteRequest(String path) {
this(new LwM2mPath(path), null);
}

Expand All @@ -43,7 +43,7 @@ public ExecuteRequest(final String path) {
* @param parameters the parameters
* @throw IllegalArgumentException if the path is not valid
*/
public ExecuteRequest(final String path, final String parameters) {
public ExecuteRequest(String path, String parameters) {
this(new LwM2mPath(path), parameters);
}

Expand All @@ -54,7 +54,7 @@ public ExecuteRequest(final String path, final String parameters) {
* @param objectInstanceId the resource's object instance ID
* @param resourceId the resource's ID
*/
public ExecuteRequest(final int objectId, final int objectInstanceId, final int resourceId) {
public ExecuteRequest(int objectId, int objectInstanceId, int resourceId) {
this(new LwM2mPath(objectId, objectInstanceId, resourceId), null);
}

Expand All @@ -66,12 +66,11 @@ public ExecuteRequest(final int objectId, final int objectInstanceId, final int
* @param resourceId the resource's ID
* @param parameters the parameters
*/
public ExecuteRequest(final int objectId, final int objectInstanceId, final int resourceId,
final String parameters) {
public ExecuteRequest(int objectId, int objectInstanceId, int resourceId, String parameters) {
this(new LwM2mPath(objectId, objectInstanceId, resourceId), parameters);
}

private ExecuteRequest(final LwM2mPath path, final String parameters) {
private ExecuteRequest(LwM2mPath path, String parameters) {
super(path);
Validate.isTrue(path.isResource(), "Only resource can be executed.");
this.parameters = parameters;
Expand All @@ -83,7 +82,7 @@ public String toString() {
}

@Override
public void accept(final DownlinkRequestVisitor visitor) {
public void accept(DownlinkRequestVisitor visitor) {
visitor.visit(this);
}

Expand Down
Expand Up @@ -24,31 +24,30 @@ public class WriteAttributesRequest extends AbstractDownlinkRequest<WriteAttribu

private final ObserveSpec observeSpec;

public WriteAttributesRequest(final int objectId, final ObserveSpec observeSpec) {
public WriteAttributesRequest(int objectId, ObserveSpec observeSpec) {
this(new LwM2mPath(objectId), observeSpec);
}

public WriteAttributesRequest(final int objectId, final int objectInstanceId, final ObserveSpec observeSpec) {
public WriteAttributesRequest(int objectId, int objectInstanceId, ObserveSpec observeSpec) {
this(new LwM2mPath(objectId, objectInstanceId), observeSpec);
}

public WriteAttributesRequest(final int objectId, final int objectInstanceId, final int resourceId,
final ObserveSpec observeSpec) {
public WriteAttributesRequest(int objectId, int objectInstanceId, int resourceId, ObserveSpec observeSpec) {
this(new LwM2mPath(objectId, objectInstanceId, resourceId), observeSpec);
}

public WriteAttributesRequest(final String path, final ObserveSpec observeSpec) {
public WriteAttributesRequest(String path, ObserveSpec observeSpec) {
this(new LwM2mPath(path), observeSpec);
}

private WriteAttributesRequest(final LwM2mPath path, final ObserveSpec observeSpec) {
private WriteAttributesRequest(LwM2mPath path, ObserveSpec observeSpec) {
super(path);
Validate.notNull(observeSpec);
this.observeSpec = observeSpec;
}

@Override
public void accept(final DownlinkRequestVisitor visitor) {
public void accept(DownlinkRequestVisitor visitor) {
visitor.visit(this);
}

Expand Down
Expand Up @@ -67,8 +67,8 @@ public enum Mode {
* @param objectInstanceId the id of the object instance to write.
* @param resources the list of resources to write.
*/
public WriteRequest(final Mode mode, final ContentFormat contentFormat, final int objectId,
final int objectInstanceId, final Collection<LwM2mResource> resources) {
public WriteRequest(Mode mode, ContentFormat contentFormat, int objectId, int objectInstanceId,
Collection<LwM2mResource> resources) {
this(mode, contentFormat, new LwM2mPath(objectId, objectInstanceId),
new LwM2mObjectInstance(objectId, resources));
}
Expand All @@ -81,8 +81,7 @@ public WriteRequest(final Mode mode, final ContentFormat contentFormat, final in
* @param objectInstanceId the id of the object instance to write.
* @param resources the list of resources to write.
*/
public WriteRequest(final Mode mode, final int objectId, final int objectInstanceId,
final Collection<LwM2mResource> resources) {
public WriteRequest(Mode mode, int objectId, int objectInstanceId, Collection<LwM2mResource> resources) {
this(mode, ContentFormat.TLV, new LwM2mPath(objectId, objectInstanceId),
new LwM2mObjectInstance(objectId, resources));
}
Expand All @@ -96,8 +95,8 @@ public WriteRequest(final Mode mode, final int objectId, final int objectInstanc
* @param objectInstanceId the id of the object instance to write.
* @param resources the list of resources to write.
*/
public WriteRequest(final Mode mode, final ContentFormat contentFormat, final int objectId,
final int objectInstanceId, final LwM2mResource... resources) {
public WriteRequest(Mode mode, ContentFormat contentFormat, int objectId, int objectInstanceId,
LwM2mResource... resources) {
this(mode, contentFormat, new LwM2mPath(objectId, objectInstanceId),
new LwM2mObjectInstance(objectId, resources));
}
Expand All @@ -110,8 +109,7 @@ public WriteRequest(final Mode mode, final ContentFormat contentFormat, final in
* @param objectInstanceId the id of the object instance to write.
* @param resources the list of resources to write.
*/
public WriteRequest(final Mode mode, final int objectId, final int objectInstanceId,
final LwM2mResource... resources) {
public WriteRequest(Mode mode, int objectId, int objectInstanceId, LwM2mResource... resources) {
this(mode, ContentFormat.TLV, new LwM2mPath(objectId, objectInstanceId),
new LwM2mObjectInstance(objectId, resources));
}
Expand All @@ -120,112 +118,107 @@ public WriteRequest(final Mode mode, final int objectId, final int objectInstanc
/**
* Request to write a <b>String Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, String value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, String value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b>String Single-Instance Resource</b> using the given content format (TEXT, TLV, JSON).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, String value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId, String value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newStringResource(resourceId, value));
}

/**
* Request to write a <b>Boolean Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, boolean value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, boolean value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b>Boolean Single-Instance Resource</b> using the given content format (TEXT, TLV, JSON).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, boolean value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId,
boolean value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newBooleanResource(resourceId, value));
}

/**
* Request to write a <b>Integer Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, long value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, long value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b>Integer Single-Instance Resource</b> using the given content format (TEXT, TLV, JSON).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, long value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId, long value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newIntegerResource(resourceId, value));
}

/**
* Request to write a <b> Float Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, double value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, double value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b> Float Single-Instance Resource</b> using the given content format (TEXT, TLV, JSON).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, double value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId, double value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newFloatResource(resourceId, value));
}

/**
* Request to write a <b> Date Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, Date value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, Date value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b> Date Single-Instance Resource</b> using the given content format (TEXT, TLV, JSON).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, Date value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId, Date value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newDateResource(resourceId, value));
}

/**
* Request to write a <b> Binary Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, byte[] value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, byte[] value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b> Binary Single-Instance Resource</b> using the given content format (OPAQUE, TLV, JSON).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, byte[] value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId, byte[] value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newBinaryResource(resourceId, value));
}

/**
* Request to write a <b> Objlnk Single-Instance Resource</b> using the TLV content format.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId, ObjectLink value) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, ObjectLink value) {
this(ContentFormat.TLV, objectId, objectInstanceId, resourceId, value);
}

/**
* Request to write a <b> Objlnk Single-Instance Resource</b> using the given content format (OPAQUE, TLV, JSON,
* TEXT).
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, ObjectLink value) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId,
ObjectLink value) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mSingleResource.newObjectLinkResource(resourceId, value));
}
Expand All @@ -241,8 +234,8 @@ public WriteRequest(final ContentFormat contentFormat, final int objectId, final
* @param values the list of resource instance (id->value) to write.
* @param type the data type of the resource.
*/
public WriteRequest(final ContentFormat contentFormat, final int objectId, final int objectInstanceId,
final int resourceId, final Map<Integer, ?> values, Type type) {
public WriteRequest(ContentFormat contentFormat, int objectId, int objectInstanceId, int resourceId,
Map<Integer, ?> values, Type type) {
this(Mode.REPLACE, contentFormat, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mMultipleResource.newResource(resourceId, values, type));
}
Expand All @@ -256,8 +249,7 @@ public WriteRequest(final ContentFormat contentFormat, final int objectId, final
* @param values the list of resource instance (id->value) to write.
* @param type the data type of the resource.
*/
public WriteRequest(final int objectId, final int objectInstanceId, final int resourceId,
final Map<Integer, ?> values, Type type) {
public WriteRequest(int objectId, int objectInstanceId, int resourceId, Map<Integer, ?> values, Type type) {
this(Mode.REPLACE, ContentFormat.TLV, new LwM2mPath(objectId, objectInstanceId, resourceId),
LwM2mMultipleResource.newResource(resourceId, values, type));
}
Expand All @@ -271,11 +263,11 @@ public WriteRequest(final int objectId, final int objectInstanceId, final int re
* @param path the path of the LWM2M node to write (object instance or resource).
* @param node the {@link LwM2mNode} to write.
*/
public WriteRequest(final Mode mode, final ContentFormat contentFormat, final String path, final LwM2mNode node) {
public WriteRequest(Mode mode, ContentFormat contentFormat, String path, LwM2mNode node) {
this(mode, contentFormat, new LwM2mPath(path), node);
}

private WriteRequest(final Mode mode, ContentFormat format, final LwM2mPath target, final LwM2mNode node) {
private WriteRequest(Mode mode, ContentFormat format, LwM2mPath target, LwM2mNode node) {
super(target);
Validate.notNull(mode);
Validate.notNull(node);
Expand Down Expand Up @@ -355,7 +347,7 @@ public ContentFormat getContentFormat() {
}

@Override
public void accept(final DownlinkRequestVisitor visitor) {
public void accept(DownlinkRequestVisitor visitor) {
visitor.visit(this);
}

Expand Down

0 comments on commit 841f3a5

Please sign in to comment.