Permalink
Browse files

configured checkstyle

  • Loading branch information...
ropalka committed Sep 17, 2012
1 parent ce0bca3 commit 7348ee6bddd02e3fc706b125496b5cf5b7189961
Showing with 1,546 additions and 539 deletions.
  1. +0 −1 TODO
  2. +307 −0 checkstyle/api.xml
  3. +296 −0 checkstyle/impl.xml
  4. +284 −0 checkstyle/test.xml
  5. +10 −0 modules/api/pom.xml
  6. +4 −5 modules/api/src/main/java/org/fossnova/json/JsonArray.java
  7. +2 −3 modules/api/src/main/java/org/fossnova/json/JsonBoolean.java
  8. +9 −10 modules/api/src/main/java/org/fossnova/json/JsonNumber.java
  9. +1 −2 modules/api/src/main/java/org/fossnova/json/JsonObject.java
  10. +3 −4 modules/api/src/main/java/org/fossnova/json/JsonString.java
  11. +3 −2 modules/api/src/main/java/org/fossnova/json/JsonValue.java
  12. +4 −5 modules/api/src/main/java/org/fossnova/json/JsonValueFactory.java
  13. +15 −0 modules/impl/pom.xml
  14. +7 −6 modules/impl/src/main/java/com/fossnova/json/JsonArrayImpl.java
  15. +6 −4 modules/impl/src/main/java/com/fossnova/json/JsonBooleanImpl.java
  16. +4 −2 modules/impl/src/main/java/com/fossnova/json/JsonNumberImpl.java
  17. +3 −1 modules/impl/src/main/java/com/fossnova/json/JsonObjectImpl.java
  18. +5 −3 modules/impl/src/main/java/com/fossnova/json/JsonStringImpl.java
  19. +10 −7 modules/impl/src/main/java/com/fossnova/json/JsonStructureImpl.java
  20. +3 −0 modules/impl/src/main/java/com/fossnova/json/JsonValueFactoryImpl.java
  21. +0 −1 modules/impl/src/main/java/com/fossnova/json/stream/JsonConstants.java
  22. +17 −14 modules/impl/src/main/java/com/fossnova/json/stream/JsonGrammarAnalyzer.java
  23. +143 −153 modules/impl/src/main/java/com/fossnova/json/stream/JsonReaderImpl.java
  24. +7 −4 modules/impl/src/main/java/com/fossnova/json/stream/JsonStreamFactoryImpl.java
  25. +17 −75 modules/impl/src/main/java/com/fossnova/json/stream/JsonWriterImpl.java
  26. +62 −11 modules/impl/src/main/java/com/fossnova/json/stream/Utils.java
  27. +15 −0 modules/tests/pom.xml
  28. +229 −1 modules/tests/src/test/java/test/fossnova/json/AbstractJsonTestCase.java
  29. +0 −184 modules/tests/src/test/java/test/fossnova/json/InvalidJsonReaderTestCase.java
  30. +17 −21 modules/tests/src/test/java/test/fossnova/json/JsonObjectTestCase.java
  31. +15 −0 modules/tests/src/test/java/test/fossnova/json/ValidJsonReaderTestCase.java
  32. +10 −1 modules/tests/src/test/java/test/fossnova/json/ValidJsonWriterTestCase.java
  33. +38 −19 pom.xml
View
1 TODO
@@ -1,4 +1,3 @@
-P1 configure checkstyle
P2 Implement configuration properties
* enable indentation
* string length limits
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -44,6 +44,16 @@
<build>
<plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+ <configLocation>../../checkstyle/api.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>false</failsOnError>
+ <useFile/>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -52,9 +52,9 @@
boolean contains( final Boolean value );
boolean contains( final JsonValue value );
-
+
boolean contains( final Object value );
-
+
int indexOf( final String value );
int indexOf( final Number value );
@@ -87,12 +87,11 @@
JsonValue set( final int index, final JsonValue value );
- public JsonArray subList( final int fromIndex, final int toIndex );
+ JsonArray subList( final int fromIndex, final int toIndex );
JsonValue[] toArray();
void writeTo( JsonWriter writer ) throws IOException;
-
- JsonArray clone();
+ JsonArray clone();
}
@@ -25,9 +25,8 @@
public interface JsonBoolean extends JsonValue {
void setBoolean( boolean b );
-
+
boolean getBoolean();
-
- JsonBoolean clone();
+ JsonBoolean clone();
}
@@ -26,39 +26,38 @@
* @author <a href="mailto:opalka dot richard at gmail dot com">Richard Opalka</a>
*/
public interface JsonNumber extends JsonValue {
-
+
void setByte( byte b );
byte getByte();
-
+
void setShort( short s );
short getShort();
void setInt( int i );
-
+
int getInt();
-
+
void setLong( long l );
long getLong();
-
+
void setFloat( float f );
float getFloat();
-
+
void setDouble( double d );
double getDouble();
-
+
void setBigInteger( BigInteger bi );
BigInteger getBigInteger();
-
+
void setBigDecimal( BigDecimal bd );
BigDecimal getBigDecimal();
-
- JsonNumber clone();
+ JsonNumber clone();
}
@@ -50,7 +50,6 @@
JsonValue remove( final String key );
void writeTo( JsonWriter writer ) throws IOException;
-
- JsonObject clone();
+ JsonObject clone();
}
@@ -23,11 +23,10 @@
* @author <a href="mailto:opalka dot richard at gmail dot com">Richard Opalka</a>
*/
public interface JsonString extends JsonValue {
-
+
void setString( String s );
-
+
String getString();
-
- JsonString clone();
+ JsonString clone();
}
@@ -19,11 +19,12 @@
*/
package org.fossnova.json;
+import java.io.Serializable;
+
/**
* @author <a href="mailto:opalka dot richard at gmail dot com">Richard Opalka</a>
*/
-public interface JsonValue extends Cloneable {
+public interface JsonValue extends Cloneable, Serializable {
JsonValue clone();
-
}
@@ -43,13 +43,12 @@ public static JsonValueFactory newInstance() {
public abstract JsonObject newJsonObject();
public abstract JsonArray newJsonArray();
-
+
public abstract JsonBoolean newJsonBoolean( Boolean value );
-
+
public abstract JsonNumber newJsonNumber( Number value );
-
+
public abstract JsonString newJsonString( String value );
-
- public abstract JsonValue readFrom( JsonReader reader ) throws IOException;
+ public abstract JsonValue readFrom( JsonReader reader ) throws IOException;
}
View
@@ -42,4 +42,19 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+ <configLocation>../../checkstyle/impl.xml</configLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>false</failsOnError>
+ <useFile/>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
@@ -36,6 +36,8 @@
*/
final class JsonArrayImpl extends JsonStructureImpl implements JsonArray {
+ private static final long serialVersionUID = 1L;
+
private final List< JsonValue > list;
JsonArrayImpl() {
@@ -81,7 +83,7 @@ public boolean addAll( final Collection< ? extends JsonValue > values ) {
public boolean addAll( final int index, final Collection< ? extends JsonValue > values ) {
return list.addAll( index, values );
}
-
+
public boolean contains( final String value ) {
return list.contains( toJsonString( value ) );
}
@@ -99,7 +101,7 @@ public boolean contains( final JsonValue value ) {
}
public boolean contains( final Object value ) {
- if ( value == null || value instanceof String ) {
+ if ( ( value == null ) || ( value instanceof String ) ) {
return contains( ( String ) value );
} else if ( value instanceof Number ) {
return contains( ( Number ) value );
@@ -132,7 +134,7 @@ public int indexOf( final JsonValue value ) {
}
public int indexOf( final Object value ) {
- if ( value == null || value instanceof String ) {
+ if ( ( value == null ) || ( value instanceof String ) ) {
return indexOf( ( String ) value );
} else if ( value instanceof Number ) {
return indexOf( ( Number ) value );
@@ -161,7 +163,7 @@ public int lastIndexOf( final JsonValue value ) {
}
public int lastIndexOf( final Object value ) {
- if ( value == null || value instanceof String ) {
+ if ( ( value == null ) || ( value instanceof String ) ) {
return lastIndexOf( ( String ) value );
} else if ( value instanceof Number ) {
return lastIndexOf( ( Number ) value );
@@ -198,7 +200,7 @@ public boolean remove( final JsonValue value ) {
}
public boolean remove( final Object value ) {
- if ( value == null || value instanceof String ) {
+ if ( ( value == null ) || ( value instanceof String ) ) {
return remove( ( String ) value );
} else if ( value instanceof Number ) {
return remove( ( Number ) value );
@@ -324,5 +326,4 @@ protected void writeTo( final JsonWriterImpl jsonWriter ) throws IOException {
boolean addInternal( final JsonValue value ) {
return list.add( value );
}
-
}
@@ -29,20 +29,22 @@
*/
final class JsonBooleanImpl implements JsonBoolean {
+ private static final long serialVersionUID = 1L;
+
private boolean value;
JsonBooleanImpl( final boolean value ) {
this.value = value;
}
-
+
public void setBoolean( final boolean value ) {
this.value = value;
}
public boolean getBoolean() {
return value;
}
-
+
@Override
public int hashCode() {
return value ? TRUE.hashCode() : FALSE.hashCode();
@@ -60,9 +62,9 @@ public boolean equals( final Object o ) {
public String toString() {
return value ? TRUE.toString() : FALSE.toString();
}
-
+
@Override
public JsonBooleanImpl clone() {
- return new JsonBooleanImpl( value );
+ return new JsonBooleanImpl( value );
}
}
@@ -29,6 +29,8 @@
*/
final class JsonNumberImpl implements JsonNumber {
+ private static final long serialVersionUID = 1L;
+
private String value;
JsonNumberImpl( final String value ) {
@@ -93,14 +95,14 @@ public void setDouble( final double value ) {
public void setBigInteger( final BigInteger value ) {
if ( value == null ) {
- throw new IllegalArgumentException( "Parameter cannot be null ");
+ throw new IllegalArgumentException( "Parameter cannot be null " );
}
this.value = String.valueOf( value );
}
public void setBigDecimal( final BigDecimal value ) {
if ( value == null ) {
- throw new IllegalArgumentException( "Parameter cannot be null ");
+ throw new IllegalArgumentException( "Parameter cannot be null " );
}
this.value = String.valueOf( value );
}
@@ -35,6 +35,8 @@
*/
final class JsonObjectImpl extends JsonStructureImpl implements JsonObject {
+ private static final long serialVersionUID = 1L;
+
private final Map< String, JsonValue > map;
JsonObjectImpl() {
@@ -66,7 +68,7 @@ public boolean containsKey( final String key ) {
}
public boolean containsValue( final Object value ) {
- if ( value == null || value instanceof String ) {
+ if ( ( value == null ) || ( value instanceof String ) ) {
return containsValue( ( String ) value );
} else if ( value instanceof Number ) {
return containsValue( ( Number ) value );
@@ -26,12 +26,14 @@
*/
final class JsonStringImpl implements JsonString {
+ private static final long serialVersionUID = 1L;
+
private String value;
JsonStringImpl( final String value ) {
this.value = value;
}
-
+
public void setString( final String value ) {
if ( value == null ) {
throw new IllegalArgumentException( "Parameter cannot be null" );
@@ -60,9 +62,9 @@ public boolean equals( final Object o ) {
public String toString() {
return value;
}
-
+
@Override
public JsonStringImpl clone() {
- return new JsonStringImpl( value );
+ return new JsonStringImpl( value );
}
}
Oops, something went wrong.

0 comments on commit 7348ee6

Please sign in to comment.