You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by th...@apache.org on 2016/05/18 20:42:10 UTC
[20/22] incubator-apex-malhar git commit: APEXMALHAR-2095 removed
checkstyle violations of malhar library module
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/3735316e/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOMutable.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOMutable.java b/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOMutable.java
index 274fbf2..3609f2e 100644
--- a/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOMutable.java
+++ b/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOMutable.java
@@ -78,70 +78,70 @@ public class GPOMutable implements Serializable
{
boolean[] oldFieldsBoolean = gpo.getFieldsBoolean();
- if(oldFieldsBoolean != null) {
+ if (oldFieldsBoolean != null) {
System.arraycopy(oldFieldsBoolean, 0, fieldsBoolean, 0, fieldsBoolean.length);
}
}
{
char[] oldFieldsChar = gpo.getFieldsCharacter();
- if(oldFieldsChar != null) {
+ if (oldFieldsChar != null) {
System.arraycopy(oldFieldsChar, 0, fieldsCharacter, 0, fieldsCharacter.length);
}
}
{
byte[] oldFieldsByte = gpo.getFieldsByte();
- if(oldFieldsByte != null) {
+ if (oldFieldsByte != null) {
System.arraycopy(oldFieldsByte, 0, fieldsByte, 0, fieldsByte.length);
}
}
{
short[] oldFieldsShort = gpo.getFieldsShort();
- if(oldFieldsShort != null) {
+ if (oldFieldsShort != null) {
System.arraycopy(oldFieldsShort, 0, fieldsShort, 0, fieldsShort.length);
}
}
{
int[] oldFieldsInteger = gpo.getFieldsInteger();
- if(oldFieldsInteger != null) {
+ if (oldFieldsInteger != null) {
System.arraycopy(oldFieldsInteger, 0, fieldsInteger, 0, fieldsInteger.length);
}
}
{
long[] oldFieldsLong = gpo.getFieldsLong();
- if(oldFieldsLong != null) {
+ if (oldFieldsLong != null) {
System.arraycopy(oldFieldsLong, 0, fieldsLong, 0, fieldsLong.length);
}
}
{
float[] oldFieldsFloat = gpo.getFieldsFloat();
- if(oldFieldsFloat != null) {
+ if (oldFieldsFloat != null) {
System.arraycopy(oldFieldsFloat, 0, fieldsFloat, 0, fieldsFloat.length);
}
}
{
double[] oldFieldsDouble = gpo.getFieldsDouble();
- if(oldFieldsDouble != null) {
+ if (oldFieldsDouble != null) {
System.arraycopy(oldFieldsDouble, 0, fieldsDouble, 0, fieldsDouble.length);
}
}
{
String[] oldFieldsString = gpo.getFieldsString();
- if(oldFieldsString != null) {
+ if (oldFieldsString != null) {
System.arraycopy(oldFieldsString, 0, fieldsString, 0, fieldsString.length);
}
}
{
Object[] oldFieldsObject = gpo.getFieldsObject();
- if(oldFieldsObject != null) {
+ if (oldFieldsObject != null) {
System.arraycopy(oldFieldsObject, 0, fieldsObject, 0, fieldsObject.length);
}
}
@@ -152,14 +152,13 @@ public class GPOMutable implements Serializable
* @param gpo The {@link GPOMutable} object to copy fields from.
* @param subsetFields The fields to copy from the given GPOMutable object.
*/
- public GPOMutable(GPOMutable gpo,
- Fields subsetFields)
+ public GPOMutable(GPOMutable gpo, Fields subsetFields)
{
this(gpo.getFieldDescriptor().getSubset(subsetFields));
initialize();
- for(String field: this.getFieldDescriptor().getFields().getFields()) {
+ for (String field : this.getFieldDescriptor().getFields().getFields()) {
this.setFieldGeneric(field, gpo.getField(field));
}
}
@@ -182,9 +181,9 @@ public class GPOMutable implements Serializable
*/
private void initialize()
{
- for(Type type: fieldDescriptor.getTypeToFields().keySet()) {
+ for (Type type : fieldDescriptor.getTypeToFields().keySet()) {
int size = fieldDescriptor.getTypeToSize().get(type);
- switch(type) {
+ switch (type) {
case BOOLEAN: {
fieldsBoolean = new boolean[size];
break;
@@ -348,47 +347,47 @@ public class GPOMutable implements Serializable
{
Type type = fieldDescriptor.getType(field);
- if(type == null) {
+ if (type == null) {
throw new IllegalArgumentException(field + " is not a valid field of this object.");
}
int index = fieldDescriptor.getTypeToFieldToIndex().get(type).get(field);
- switch(type) {
+ switch (type) {
case BOOLEAN: {
- fieldsBoolean[index] = (Boolean) val;
+ fieldsBoolean[index] = (Boolean)val;
break;
}
case CHAR: {
- fieldsCharacter[index] = (Character) val;
+ fieldsCharacter[index] = (Character)val;
break;
}
case STRING: {
- fieldsString[index] = (String) val;
+ fieldsString[index] = (String)val;
break;
}
case BYTE: {
- fieldsByte[index] = (Byte) val;
+ fieldsByte[index] = (Byte)val;
break;
}
case SHORT: {
- fieldsShort[index] = (Short) val;
+ fieldsShort[index] = (Short)val;
break;
}
case INTEGER: {
- fieldsInteger[index] = (Integer) val;
+ fieldsInteger[index] = (Integer)val;
break;
}
case LONG: {
- fieldsLong[index] = (Long) val;
+ fieldsLong[index] = (Long)val;
break;
}
case FLOAT: {
- fieldsFloat[index] = (Float) val;
+ fieldsFloat[index] = (Float)val;
break;
}
case DOUBLE: {
- fieldsDouble[index] = (Double) val;
+ fieldsDouble[index] = (Double)val;
break;
}
case OBJECT: {
@@ -409,13 +408,13 @@ public class GPOMutable implements Serializable
{
Type type = fieldDescriptor.getType(field);
- if(type == null) {
+ if (type == null) {
throw new IllegalArgumentException(field + " is not a valid field of this object.");
}
int index = fieldDescriptor.getTypeToFieldToIndex().get(type).get(field);
- switch(type) {
+ switch (type) {
case BOOLEAN: {
return fieldsBoolean[index];
}
@@ -677,15 +676,14 @@ public class GPOMutable implements Serializable
private void throwInvalidField(String field, Type type)
{
Type fieldType = fieldDescriptor.getType(field);
- if(fieldType == null || !fieldType.equals(type)) {
- throw new IllegalArgumentException(field + " is not a valid field of type " +
- type + " on this object.");
+ if (fieldType == null || !fieldType.equals(type)) {
+ throw new IllegalArgumentException(field + " is not a valid field of type " + type + " on this object.");
}
}
public void applyObjectPayloadFix()
{
- if(fieldDescriptor.getSerdePayloadFix() != null) {
+ if (fieldDescriptor.getSerdePayloadFix() != null) {
fieldDescriptor.getSerdePayloadFix().fix(fieldsObject);
}
}
@@ -710,44 +708,45 @@ public class GPOMutable implements Serializable
@Override
public boolean equals(Object obj)
{
- if(obj == null) {
+ if (obj == null) {
return false;
}
- if(!(obj instanceof GPOMutable)) {
+ if (!(obj instanceof GPOMutable)) {
return false;
}
final GPOMutable other = (GPOMutable)obj;
- if(!Arrays.equals(this.fieldsBoolean, other.fieldsBoolean)) {
+ if (!Arrays.equals(this.fieldsBoolean, other.fieldsBoolean)) {
return false;
}
- if(!Arrays.equals(this.fieldsCharacter, other.fieldsCharacter)) {
+ if (!Arrays.equals(this.fieldsCharacter, other.fieldsCharacter)) {
return false;
}
- if(!Arrays.equals(this.fieldsByte, other.fieldsByte)) {
+ if (!Arrays.equals(this.fieldsByte, other.fieldsByte)) {
return false;
}
- if(!Arrays.equals(this.fieldsShort, other.fieldsShort)) {
+ if (!Arrays.equals(this.fieldsShort, other.fieldsShort)) {
return false;
}
- if(!Arrays.equals(this.fieldsInteger, other.fieldsInteger)) {
+ if (!Arrays.equals(this.fieldsInteger, other.fieldsInteger)) {
return false;
}
- if(!Arrays.equals(this.fieldsLong, other.fieldsLong)) {
+ if (!Arrays.equals(this.fieldsLong, other.fieldsLong)) {
return false;
}
- if(!Arrays.equals(this.fieldsFloat, other.fieldsFloat)) {
+ if (!Arrays.equals(this.fieldsFloat, other.fieldsFloat)) {
return false;
}
- if(!Arrays.equals(this.fieldsDouble, other.fieldsDouble)) {
+ if (!Arrays.equals(this.fieldsDouble, other.fieldsDouble)) {
return false;
}
- if(!Arrays.deepEquals(this.fieldsString, other.fieldsString)) {
+ if (!Arrays.deepEquals(this.fieldsString, other.fieldsString)) {
return false;
}
- if(!Arrays.deepEquals(this.fieldsObject, other.fieldsObject)) {
+ if (!Arrays.deepEquals(this.fieldsObject, other.fieldsObject)) {
return false;
}
- if(this.fieldDescriptor != other.fieldDescriptor && (this.fieldDescriptor == null || !this.fieldDescriptor.equals(other.fieldDescriptor))) {
+ if (this.fieldDescriptor != other.fieldDescriptor && (this.fieldDescriptor == null
+ || !this.fieldDescriptor.equals(other.fieldDescriptor))) {
return false;
}
return true;
@@ -756,6 +755,11 @@ public class GPOMutable implements Serializable
@Override
public String toString()
{
- return "GPOMutable{" + "fieldsBoolean=" + Arrays.toString(fieldsBoolean) + ", fieldsCharacter=" + Arrays.toString(fieldsCharacter) + ", fieldsByte=" + Arrays.toString(fieldsByte) + ", fieldsShort=" + Arrays.toString(fieldsShort) + ", fieldsInteger=" + Arrays.toString(fieldsInteger) + ", fieldsLong=" + Arrays.toString(fieldsLong) + ", fieldsFloat=" + Arrays.toString(fieldsFloat) + ", fieldsDouble=" + Arrays.toString(fieldsDouble) + ", fieldsString=" + Arrays.toString(fieldsString) + ", fieldDescriptor=" + fieldDescriptor + '}';
+ return "GPOMutable{" + "fieldsBoolean=" + Arrays.toString(fieldsBoolean) + ", fieldsCharacter="
+ + Arrays.toString(fieldsCharacter) + ", fieldsByte=" + Arrays.toString(fieldsByte) + ", fieldsShort="
+ + Arrays.toString(fieldsShort) + ", fieldsInteger=" + Arrays.toString(fieldsInteger) + ", fieldsLong="
+ + Arrays.toString(fieldsLong) + ", fieldsFloat=" + Arrays.toString(fieldsFloat) + ", fieldsDouble="
+ + Arrays.toString(fieldsDouble) + ", fieldsString=" + Arrays.toString(fieldsString) + ", fieldDescriptor="
+ + fieldDescriptor + '}';
}
}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/3735316e/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOType.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOType.java b/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOType.java
index 28ff03c..2e202b4 100644
--- a/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOType.java
+++ b/library/src/main/java/com/datatorrent/lib/appdata/gpo/GPOType.java
@@ -34,7 +34,27 @@ import com.datatorrent.lib.util.PojoUtils.GetterBoolean;
import com.datatorrent.lib.util.PojoUtils.GetterByte;
import com.datatorrent.lib.util.PojoUtils.GetterChar;
-import static com.datatorrent.lib.appdata.gpo.GPOUtils.*;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.createGetters;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.createGettersObject;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.createGettersString;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeBoolean;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeByte;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeChar;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeDouble;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeFloat;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeInt;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeLong;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeShort;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.deserializeString;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeBoolean;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeByte;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeChar;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeDouble;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeFloat;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeInt;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeLong;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeShort;
+import static com.datatorrent.lib.appdata.gpo.GPOUtils.serializeString;
/**
* This is a helper class that reduces the need for switch statements in may utility method in {@link GPOUtils}.
@@ -44,17 +64,14 @@ abstract class GPOType
{
public static final GPOType[] GPO_TYPE_ARRAY;
- static
- {
+ static {
GPO_TYPE_ARRAY = new GPOType[Type.values().length];
Type[] types = Type.values();
- for(int index = 0;
- index < types.length;
- index++) {
+ for (int index = 0; index < types.length; index++) {
Type type = types[index];
- switch(type) {
+ switch (type) {
case BOOLEAN: {
GPO_TYPE_ARRAY[index] = new BooleanT();
break;
@@ -102,11 +119,19 @@ abstract class GPOType
}
public abstract void setFieldFromJSON(GPOMutable gpo, String field, JSONArray jo, int index);
- public abstract void serializeJSONObject(JSONObject jo, GPOMutable gpo, String field, ResultFormatter resultFormatter) throws JSONException;
+
+ public abstract void serializeJSONObject(JSONObject jo, GPOMutable gpo, String field, ResultFormatter resultFormatter)
+ throws JSONException;
+
public abstract void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset);
+
public abstract void deserialize(GPOMutable gpo, String Field, byte[] serializedGPO, MutableInt offset);
- public abstract void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter, Class<?> clazz);
+
+ public abstract void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter,
+ Class<?> clazz);
+
public abstract byte[] serialize(Object object);
+
public abstract Object deserialize(byte[] object, MutableInt offset);
public static class BooleanT extends GPOType
@@ -120,30 +145,28 @@ abstract class GPOType
@Override
public void setFieldFromJSON(GPOMutable gpo, String field, JSONArray jo, int index)
{
- Boolean val;
+ Boolean val;
- try {
- val = jo.getBoolean(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key " + field + " does not have a valid bool value.", ex);
- }
+ try {
+ val = jo.getBoolean(index);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid bool value.", ex);
+ }
- gpo.setFieldGeneric(field, val);
+ gpo.setFieldGeneric(field, val);
}
@Override
- public void serializeJSONObject(JSONObject jo, GPOMutable gpo, String field, ResultFormatter resultFormatter) throws JSONException
+ public void serializeJSONObject(JSONObject jo, GPOMutable gpo, String field, ResultFormatter resultFormatter)
+ throws JSONException
{
- jo.put(field, gpo.getFieldBool(field));
+ jo.put(field, gpo.getFieldBool(field));
}
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeBoolean(gpo.getFieldBool(field),
- sbytes,
- offset);
+ serializeBoolean(gpo.getFieldBool(field), sbytes, offset);
}
@Override
@@ -156,17 +179,13 @@ abstract class GPOType
@Override
public void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter, Class<?> clazz)
{
- gpoGetters.gettersBoolean = createGetters(fields,
- fieldToGetter,
- clazz,
- boolean.class,
- GetterBoolean.class);
+ gpoGetters.gettersBoolean = createGetters(fields, fieldToGetter, clazz, boolean.class, GetterBoolean.class);
}
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeBoolean((Boolean) object);
+ return GPOUtils.serializeBoolean((Boolean)object);
}
@Override
@@ -191,12 +210,8 @@ abstract class GPOType
try {
val = jo.getLong(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid long value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid long value.", ex);
}
gpo.setField(field, val);
@@ -211,9 +226,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeChar(gpo.getFieldChar(field),
- sbytes,
- offset);
+ serializeChar(gpo.getFieldChar(field), sbytes, offset);
}
@Override
@@ -226,17 +239,13 @@ abstract class GPOType
@Override
public void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter, Class<?> clazz)
{
- gpoGetters.gettersChar = createGetters(fields,
- fieldToGetter,
- clazz,
- char.class,
- GetterChar.class);
+ gpoGetters.gettersChar = createGetters(fields, fieldToGetter, clazz, char.class, GetterChar.class);
}
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeChar((Character) object);
+ return GPOUtils.serializeChar((Character)object);
}
@Override
@@ -261,12 +270,8 @@ abstract class GPOType
try {
val = jo.getString(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid string value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid string value.", ex);
}
gpo.setField(field, val);
@@ -281,9 +286,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeString(gpo.getFieldString(field),
- sbytes,
- offset);
+ serializeString(gpo.getFieldString(field), sbytes, offset);
}
@Override
@@ -296,15 +299,13 @@ abstract class GPOType
@Override
public void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter, Class<?> clazz)
{
- gpoGetters.gettersString = createGettersString(fields,
- fieldToGetter,
- clazz);
+ gpoGetters.gettersString = createGettersString(fields, fieldToGetter, clazz);
}
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeString((String) object);
+ return GPOUtils.serializeString((String)object);
}
@Override
@@ -382,27 +383,18 @@ abstract class GPOType
try {
val = jo.getInt(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid byte value.", ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid byte value.", ex);
}
- if(val < (int)Byte.MIN_VALUE) {
- throw new IllegalArgumentException("The key "
- + field
- + " has a value "
- + val
- + " which is too small to fit into a byte.");
+ if (val < (int)Byte.MIN_VALUE) {
+ throw new IllegalArgumentException("The key " + field + " has a value " + val
+ + " which is too small to fit into a byte.");
}
- if(val > (int)Byte.MAX_VALUE) {
- throw new IllegalArgumentException("The key "
- + field
- + " has a value "
- + val
- + " which is too larg to fit into a byte.");
+ if (val > (int)Byte.MAX_VALUE) {
+ throw new IllegalArgumentException("The key " + field + " has a value " + val
+ + " which is too larg to fit into a byte.");
}
gpo.setField(field, (byte)val);
@@ -417,9 +409,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeByte(gpo.getFieldByte(field),
- sbytes,
- offset);
+ serializeByte(gpo.getFieldByte(field), sbytes, offset);
}
@Override
@@ -442,7 +432,7 @@ abstract class GPOType
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeByte((Byte) object);
+ return GPOUtils.serializeByte((Byte)object);
}
@Override
@@ -467,28 +457,18 @@ abstract class GPOType
try {
val = jo.getInt(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid short value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid short value.", ex);
}
- if(val < (int)Short.MIN_VALUE) {
- throw new IllegalArgumentException("The key "
- + field
- + " has a value "
- + val
- + " which is too small to fit into a short.");
+ if (val < (int)Short.MIN_VALUE) {
+ throw new IllegalArgumentException("The key " + field + " has a value " + val
+ + " which is too small to fit into a short.");
}
- if(val > (int)Short.MAX_VALUE) {
- throw new IllegalArgumentException("The key "
- + field
- + " has a value "
- + val
- + " which is too large to fit into a short.");
+ if (val > (int)Short.MAX_VALUE) {
+ throw new IllegalArgumentException("The key " + field + " has a value " + val
+ + " which is too large to fit into a short.");
}
gpo.setField(field, (short)val);
@@ -503,9 +483,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeShort(gpo.getFieldShort(field),
- sbytes,
- offset);
+ serializeShort(gpo.getFieldShort(field), sbytes, offset);
}
@Override
@@ -528,7 +506,7 @@ abstract class GPOType
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeShort((Short) object);
+ return GPOUtils.serializeShort((Short)object);
}
@Override
@@ -553,12 +531,8 @@ abstract class GPOType
try {
val = jo.getInt(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid int value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid int value.", ex);
}
gpo.setField(field, val);
@@ -573,9 +547,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeInt(gpo.getFieldInt(field),
- sbytes,
- offset);
+ serializeInt(gpo.getFieldInt(field), sbytes, offset);
}
@Override
@@ -598,7 +570,7 @@ abstract class GPOType
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeInt((Integer) object);
+ return GPOUtils.serializeInt((Integer)object);
}
@Override
@@ -623,12 +595,8 @@ abstract class GPOType
try {
val = jo.getLong(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid long value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid long value.", ex);
}
gpo.setField(field, val);
@@ -643,9 +611,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeLong(gpo.getFieldLong(field),
- sbytes,
- offset);
+ serializeLong(gpo.getFieldLong(field), sbytes, offset);
}
@Override
@@ -668,7 +634,7 @@ abstract class GPOType
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeLong((Long) object);
+ return GPOUtils.serializeLong((Long)object);
}
@Override
@@ -693,12 +659,8 @@ abstract class GPOType
try {
val = (float)jo.getDouble(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid double value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid double value.", ex);
}
gpo.setFieldGeneric(field, val);
@@ -713,9 +675,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeFloat(gpo.getFieldFloat(field),
- sbytes,
- offset);
+ serializeFloat(gpo.getFieldFloat(field), sbytes, offset);
}
@Override
@@ -728,17 +688,13 @@ abstract class GPOType
@Override
public void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter, Class<?> clazz)
{
- gpoGetters.gettersFloat = createGetters(fields,
- fieldToGetter,
- clazz,
- float.class,
- PojoUtils.GetterFloat.class);
+ gpoGetters.gettersFloat = createGetters(fields, fieldToGetter, clazz, float.class, PojoUtils.GetterFloat.class);
}
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeFloat((Float) object);
+ return GPOUtils.serializeFloat((Float)object);
}
@Override
@@ -763,12 +719,8 @@ abstract class GPOType
try {
val = jo.getDouble(index);
- }
- catch(JSONException ex) {
- throw new IllegalArgumentException("The key "
- + field
- + " does not have a valid double value.",
- ex);
+ } catch (JSONException ex) {
+ throw new IllegalArgumentException("The key " + field + " does not have a valid double value.", ex);
}
gpo.setFieldGeneric(field, val);
@@ -783,9 +735,7 @@ abstract class GPOType
@Override
public void serialize(GPOMutable gpo, String field, byte[] sbytes, MutableInt offset)
{
- serializeDouble(gpo.getFieldDouble(field),
- sbytes,
- offset);
+ serializeDouble(gpo.getFieldDouble(field), sbytes, offset);
}
@Override
@@ -798,17 +748,13 @@ abstract class GPOType
@Override
public void buildGPOGetters(GPOGetters gpoGetters, List<String> fields, Map<String, String> fieldToGetter, Class<?> clazz)
{
- gpoGetters.gettersDouble = createGetters(fields,
- fieldToGetter,
- clazz,
- double.class,
- PojoUtils.GetterDouble.class);
+ gpoGetters.gettersDouble = createGetters(fields, fieldToGetter, clazz, double.class, PojoUtils.GetterDouble.class);
}
@Override
public byte[] serialize(Object object)
{
- return GPOUtils.serializeDouble((Double) object);
+ return GPOUtils.serializeDouble((Double)object);
}
@Override