You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by ni...@apache.org on 2016/05/02 17:36:28 UTC
[11/12] avro git commit: AVRO-1828: Add EditorConfig file and cleanup
of whitespace violations
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/Schema.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
index e2ba927..8125692 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
@@ -63,7 +63,7 @@ import org.codehaus.jackson.node.DoubleNode;
* <li>A <i>boolean</i>; or
* <li><i>null</i>.
* </ul>
- *
+ *
* A schema can be constructed using one of its static <tt>createXXX</tt>
* methods, or more conveniently using {@link SchemaBuilder}. The schema objects are
* <i>logically</i> immutable.
@@ -231,13 +231,13 @@ public abstract class Schema extends JsonProperties {
/** If this is an enum, return its symbols. */
public List<String> getEnumSymbols() {
throw new AvroRuntimeException("Not an enum: "+this);
- }
+ }
/** If this is an enum, return a symbol's ordinal value. */
public int getEnumOrdinal(String symbol) {
throw new AvroRuntimeException("Not an enum: "+this);
- }
-
+ }
+
/** If this is an enum, returns true if it contains given symbol. */
public boolean hasEnumSymbol(String symbol) {
throw new AvroRuntimeException("Not an enum: "+this);
@@ -460,7 +460,7 @@ public abstract class Schema extends JsonProperties {
props.equals(that.props);
}
public int hashCode() { return name.hashCode() + schema.computeHash(); }
-
+
private boolean defaultValueEquals(JsonNode thatDefaultValue) {
if (defaultValue == null)
return thatDefaultValue == null;
@@ -870,12 +870,12 @@ public abstract class Schema extends JsonProperties {
hash += type.computeHash();
return hash;
}
-
+
@Override
public void addProp(String name, String value) {
throw new AvroRuntimeException("Can't set properties on a union: "+this);
}
-
+
void toJson(Names names, JsonGenerator gen) throws IOException {
gen.writeStartArray();
for (Schema type : types)
@@ -944,7 +944,7 @@ public abstract class Schema extends JsonProperties {
private static class BooleanSchema extends Schema {
public BooleanSchema() { super(Type.BOOLEAN); }
}
-
+
private static class NullSchema extends Schema {
public NullSchema() { super(Type.NULL); }
}
@@ -1012,7 +1012,7 @@ public abstract class Schema extends JsonProperties {
b.append(part);
return parse(b.toString());
}
-
+
/** Parse a schema from the provided string.
* If named, the schema is added to the names known to this parser. */
public Schema parse(String s) {
@@ -1129,14 +1129,14 @@ public abstract class Schema extends JsonProperties {
return super.put(name, schema);
}
}
-
+
private static ThreadLocal<Boolean> validateNames
= new ThreadLocal<Boolean>() {
@Override protected Boolean initialValue() {
return true;
}
};
-
+
private static String validateName(String name) {
if (!validateNames.get()) return name; // not validating names
int length = name.length();
@@ -1159,7 +1159,7 @@ public abstract class Schema extends JsonProperties {
return false;
}
};
-
+
private static JsonNode validateDefault(String fieldName, Schema schema,
JsonNode defaultValue) {
if (VALIDATE_DEFAULTS.get() && (defaultValue != null)
@@ -1175,7 +1175,7 @@ public abstract class Schema extends JsonProperties {
if (defaultValue == null)
return false;
switch (schema.getType()) {
- case STRING:
+ case STRING:
case BYTES:
case ENUM:
case FIXED:
@@ -1356,7 +1356,7 @@ public abstract class Schema extends JsonProperties {
throw new SchemaParseException("alias not a string: "+aliasNode);
aliases.add(aliasNode.getTextValue());
}
- return aliases;
+ return aliases;
}
/** Extracts text value associated to key from the container JsonNode,
@@ -1413,7 +1413,7 @@ public abstract class Schema extends JsonProperties {
if (aliases.size() == 0 && fieldAliases.size() == 0)
return writer; // no aliases
-
+
seen.clear();
return applyAliases(writer, seen, aliases, fieldAliases);
}
@@ -1533,13 +1533,13 @@ public abstract class Schema extends JsonProperties {
* called on it.
* @param <E>
*/
-
+
/*
* This class keeps a boolean variable <tt>locked</tt> which is set
* to <tt>true</tt> in the lock() method. It's legal to call
* lock() any number of times. Any lock() other than the first one
* is a no-op.
- *
+ *
* This class throws <tt>IllegalStateException</tt> if a mutating
* operation is performed after being locked. Since modifications through
* iterator also use the list's mutating operations, this effectively
@@ -1548,7 +1548,7 @@ public abstract class Schema extends JsonProperties {
static class LockableArrayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 1L;
private boolean locked = false;
-
+
public LockableArrayList() {
}
@@ -1580,42 +1580,42 @@ public abstract class Schema extends JsonProperties {
ensureUnlocked();
return super.add(e);
}
-
+
public boolean remove(Object o) {
ensureUnlocked();
return super.remove(o);
}
-
+
public E remove(int index) {
ensureUnlocked();
return super.remove(index);
}
-
+
public boolean addAll(Collection<? extends E> c) {
ensureUnlocked();
return super.addAll(c);
}
-
+
public boolean addAll(int index, Collection<? extends E> c) {
ensureUnlocked();
return super.addAll(index, c);
}
-
+
public boolean removeAll(Collection<?> c) {
ensureUnlocked();
return super.removeAll(c);
}
-
+
public boolean retainAll(Collection<?> c) {
ensureUnlocked();
return super.retainAll(c);
}
-
+
public void clear() {
ensureUnlocked();
super.clear();
}
}
-
+
}
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
index 5573014..f1a1faa 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
@@ -44,7 +44,7 @@ import org.codehaus.jackson.node.TextNode;
* </p>
* For example, the below JSON schema and the fluent builder code to create it
* are very similar:
- *
+ *
* <pre>
* {
* "type": "record",
@@ -58,7 +58,7 @@ import org.codehaus.jackson.node.TextNode;
* ]
* }
* </pre>
- *
+ *
* <pre>
* Schema schema = SchemaBuilder
* .record("HandshakeRequest").namespace("org.apache.avro.ipc)
@@ -70,7 +70,7 @@ import org.codehaus.jackson.node.TextNode;
* .endRecord();
* </pre>
* <p/>
- *
+ *
* <h5>Usage Guide</h5>
* SchemaBuilder chains together many smaller builders and maintains nested
* context in order to mimic the Avro Schema specification. Every Avro type in
@@ -87,7 +87,7 @@ import org.codehaus.jackson.node.TextNode;
* share a similar API for selecting and building types.
* <p/>
* <h5>Primitive Types</h5>
- * All Avro primitive types are trivial to configure. A primitive type in
+ * All Avro primitive types are trivial to configure. A primitive type in
* Avro JSON can be declared two ways, one that supports custom properties
* and one that does not:
* <pre>
@@ -141,12 +141,12 @@ import org.codehaus.jackson.node.TextNode;
* <h6>Nested Types</h6>
* The Avro nested types, map and array, can have custom properties like
* all avro types, are not named, and must specify a nested type.
- * After configuration of optional properties, an array or map
+ * After configuration of optional properties, an array or map
* builds or selects its nested type with {@link ArrayBuilder#items()}
* and {@link MapBuilder#values()}, respectively.
- *
+ *
* <h6>Fields</h6>
- * {@link RecordBuilder#fields()} returns a {@link FieldAssembler} for
+ * {@link RecordBuilder#fields()} returns a {@link FieldAssembler} for
* defining the fields of the record and completing it.
* Each field must have a name, specified via {@link FieldAssembler#name(String)},
* which returns a {@link FieldBuilder} for defining aliases, custom properties,
@@ -159,9 +159,9 @@ import org.codehaus.jackson.node.TextNode;
* {@link IntDefault#intDefault(int)}
* <p/>
* There are field shortcut methods on {@link FieldAssembler} for primitive types.
- * These shortcuts create required, optional, and nullable fields, but do not
+ * These shortcuts create required, optional, and nullable fields, but do not
* support field aliases, doc, or custom properties.
- *
+ *
* <h6>Unions</h6>
* Union types are built via {@link TypeBuilder#unionOf()} or
* {@link FieldTypeBuilder#unionOf()} in the context of type selection.
@@ -196,7 +196,7 @@ import org.codehaus.jackson.node.TextNode;
* .name("f").type().unionOf().nullType().and().longType().endUnion().nullDefault()
* .name("f").type().optional().longType()
* </pre>
- *
+ *
* <h6>Explicit Types and Types by Name</h6>
* Types can also be specified explicitly by passing in a Schema, or by name:
* <pre>
@@ -218,7 +218,7 @@ public class SchemaBuilder {
private SchemaBuilder() {
}
-
+
/**
* Create a builder for Avro schemas.
*/
@@ -234,7 +234,7 @@ public class SchemaBuilder {
return new TypeBuilder<Schema>(new SchemaCompletion(),
new NameContext().namespace(namespace));
}
-
+
/**
* Create a builder for an Avro record with the specified name.
* This is equivalent to:
@@ -292,7 +292,7 @@ public class SchemaBuilder {
public static MapBuilder<Schema> map() {
return builder().map();
}
-
+
/**
* Create a builder for an Avro union
* This is equivalent to:
@@ -303,7 +303,7 @@ public class SchemaBuilder {
public static BaseTypeBuilder<UnionAccumulator<Schema>> unionOf() {
return builder().unionOf();
}
-
+
/**
* Create a builder for a union of a type and null.
* This is a shortcut for:
@@ -322,7 +322,7 @@ public class SchemaBuilder {
return builder().nullable();
}
-
+
/**
* An abstract builder for all Avro types. All Avro types
* can have arbitrary string key-value properties.
@@ -331,14 +331,14 @@ public class SchemaBuilder {
private Map<String, JsonNode> props = null;
protected PropBuilder() {
}
-
+
/**
* Set name-value pair properties for this type or field.
*/
public final S prop(String name, String val) {
return prop(name, TextNode.valueOf(val));
}
-
+
// for internal use by the Parser
final S prop(String name, JsonNode val) {
if(!hasProps()) {
@@ -347,11 +347,11 @@ public class SchemaBuilder {
props.put(name, val);
return self();
}
-
+
private boolean hasProps() {
return (props != null);
}
-
+
final <T extends JsonProperties> T addPropsTo(T jsonable) {
if (hasProps()) {
for(Map.Entry<String, JsonNode> prop : props.entrySet()) {
@@ -364,7 +364,7 @@ public class SchemaBuilder {
* must return 'this' **/
protected abstract S self();
}
-
+
/**
* An abstract type that provides builder methods for configuring the name,
* doc, and aliases of all Avro types that have names (fields, Fixed, Record,
@@ -429,7 +429,7 @@ public class SchemaBuilder {
return field;
}
}
-
+
/**
* An abstract type that provides builder methods for configuring the
* namespace for all Avro types that have namespaces (Fixed, Record, and
@@ -475,7 +475,7 @@ public class SchemaBuilder {
return context;
}
}
-
+
/**
* An abstraction for sharing code amongst all primitive type builders.
*/
@@ -779,7 +779,7 @@ public class SchemaBuilder {
}
}
-
+
/**
* Builds an Avro Map type with optional properties.
* <p/>
@@ -873,12 +873,12 @@ public class SchemaBuilder {
/**
* internal class for passing the naming context around. This allows for the
- * following:
+ * following:
* <li>Cache and re-use primitive schemas when they do not set
* properties.</li>
* <li>Provide a default namespace for nested contexts (as
* the JSON Schema spec does).</li>
- * <li>Allow previously defined named types or primitive types
+ * <li>Allow previously defined named types or primitive types
* to be referenced by name.</li>
**/
private static class NameContext {
@@ -895,7 +895,7 @@ public class SchemaBuilder {
}
private final HashMap<String, Schema> schemas;
private final String namespace;
-
+
private NameContext() {
this.schemas = new HashMap<String, Schema>();
this.namespace = null;
@@ -908,20 +908,20 @@ public class SchemaBuilder {
schemas.put("bytes", Schema.create(Schema.Type.BYTES));
schemas.put("string", Schema.create(Schema.Type.STRING));
}
-
+
private NameContext(HashMap<String, Schema> schemas, String namespace) {
this.schemas = schemas;
this.namespace = "".equals(namespace) ? null : namespace;
}
-
+
private NameContext namespace(String namespace) {
return new NameContext(schemas, namespace);
}
-
+
private Schema get(String name, String namespace) {
return getFullname(resolveName(name, namespace));
}
-
+
private Schema getFullname(String fullName) {
Schema schema = schemas.get(fullName);
if(schema == null) {
@@ -929,7 +929,7 @@ public class SchemaBuilder {
}
return schema;
}
-
+
private void put(Schema schema) {
String fullName = schema.getFullName();
if(schemas.containsKey(fullName)){
@@ -937,7 +937,7 @@ public class SchemaBuilder {
}
schemas.put(fullName, schema);
}
-
+
private String resolveName(String name, String space) {
if (PRIMITIVES.contains(name) && space == null) {
return name;
@@ -950,11 +950,11 @@ public class SchemaBuilder {
if (space != null && !"".equals(space)) {
return space + "." + name;
}
- }
+ }
return name;
}
}
-
+
/**
* A common API for building types within a context. BaseTypeBuilder can build
* all types other than Unions. {@link TypeBuilder} can additionally build
@@ -971,17 +971,17 @@ public class SchemaBuilder {
public static class BaseTypeBuilder<R> {
private final Completion<R> context;
private final NameContext names;
-
+
private BaseTypeBuilder(Completion<R> context, NameContext names) {
this.context = context;
this.names = names;
}
-
+
/** Use the schema provided as the type. **/
public final R type(Schema schema) {
return context.complete(schema);
}
-
+
/**
* Look up the type by name. This type must be previously defined in the
* context of this builder.
@@ -993,7 +993,7 @@ public class SchemaBuilder {
public final R type(String name) {
return type(name, null);
}
-
+
/**
* Look up the type by name and namespace. This type must be previously
* defined in the context of this builder.
@@ -1042,7 +1042,7 @@ public class SchemaBuilder {
public final IntBuilder<R> intBuilder() {
return IntBuilder.create(context, names);
}
-
+
/**
* A plain long type without custom properties. This is equivalent to:
* <pre>
@@ -1159,7 +1159,7 @@ public class SchemaBuilder {
* <pre>
* {"type":"map", "values":"int"}
* </pre>
- **/
+ **/
public final MapBuilder<R> map() {
return MapBuilder.create(context, names);
}
@@ -1172,7 +1172,7 @@ public class SchemaBuilder {
* <pre>
* {"type":"array", "values":"long"}
* </pre>
- **/
+ **/
public final ArrayBuilder<R> array() {
return ArrayBuilder.create(context, names);
}
@@ -1185,12 +1185,12 @@ public class SchemaBuilder {
* <pre>
* {"type":"fixed", "name":"com.foo.IPv4", "size":4}
* </pre>
- **/
+ **/
public final FixedBuilder<R> fixed(String name) {
return FixedBuilder.create(context, names, name);
}
-
- /** Build an Avro enum type. Example usage:
+
+ /** Build an Avro enum type. Example usage:
* <pre>
* enumeration("Suits").namespace("org.cards").doc("card suit names")
* .symbols("HEART", "SPADE", "DIAMOND", "CLUB")
@@ -1201,7 +1201,7 @@ public class SchemaBuilder {
* "doc":"card suit names", "symbols":[
* "HEART", "SPADE", "DIAMOND", "CLUB"]}
* </pre>
- **/
+ **/
public final EnumBuilder<R> enumeration(String name) {
return EnumBuilder.create(context, names, name);
}
@@ -1224,18 +1224,18 @@ public class SchemaBuilder {
* ]}
* ]}
* </pre>
- **/
+ **/
public final RecordBuilder<R> record(String name) {
- return RecordBuilder.create(context, names, name);
+ return RecordBuilder.create(context, names, name);
}
-
+
/** Build an Avro union schema type. Example usage:
* <pre>unionOf().stringType().and().bytesType().endUnion()</pre>
- **/
+ **/
protected BaseTypeBuilder<UnionAccumulator<R>> unionOf() {
return UnionBuilder.create(context, names);
}
-
+
/** A shortcut for building a union of a type and null.
* <p/>
* For example, the code snippets below are equivalent:
@@ -1245,10 +1245,10 @@ public class SchemaBuilder {
protected BaseTypeBuilder<R> nullable() {
return new BaseTypeBuilder<R>(new NullableCompletion<R>(context), names);
}
-
+
}
- /** A Builder for creating any Avro schema type.
+ /** A Builder for creating any Avro schema type.
**/
public static final class TypeBuilder<R> extends BaseTypeBuilder<R> {
private TypeBuilder(Completion<R> context, NameContext names) {
@@ -1259,7 +1259,7 @@ public class SchemaBuilder {
public BaseTypeBuilder<UnionAccumulator<R>> unionOf() {
return super.unionOf();
}
-
+
@Override
public BaseTypeBuilder<R> nullable() {
return super.nullable();
@@ -1310,7 +1310,7 @@ public class SchemaBuilder {
this.names = bldr.names();
this.wrapper = wrapper;
}
-
+
/**
* A plain boolean type without custom properties. This is equivalent to:
* <pre>
@@ -1346,7 +1346,7 @@ public class SchemaBuilder {
public final IntBuilder<IntDefault<R>> intBuilder() {
return IntBuilder.create(wrap(new IntDefault<R>(bldr)), names);
}
-
+
/**
* A plain long type without custom properties. This is equivalent to:
* <pre>
@@ -1455,31 +1455,31 @@ public class SchemaBuilder {
return NullBuilder.create(wrap(new NullDefault<R>(bldr)), names);
}
- /** Build an Avro map type **/
+ /** Build an Avro map type **/
public final MapBuilder<MapDefault<R>> map() {
return MapBuilder.create(wrap(new MapDefault<R>(bldr)), names);
}
- /** Build an Avro array type **/
+ /** Build an Avro array type **/
public final ArrayBuilder<ArrayDefault<R>> array() {
return ArrayBuilder.create(wrap(new ArrayDefault<R>(bldr)), names);
}
- /** Build an Avro fixed type. **/
+ /** Build an Avro fixed type. **/
public final FixedBuilder<FixedDefault<R>> fixed(String name) {
return FixedBuilder.create(wrap(new FixedDefault<R>(bldr)), names, name);
}
-
- /** Build an Avro enum type. **/
+
+ /** Build an Avro enum type. **/
public final EnumBuilder<EnumDefault<R>> enumeration(String name) {
return EnumBuilder.create(wrap(new EnumDefault<R>(bldr)), names, name);
}
- /** Build an Avro record type. **/
+ /** Build an Avro record type. **/
public final RecordBuilder<RecordDefault<R>> record(String name) {
- return RecordBuilder.create(wrap(new RecordDefault<R>(bldr)), names, name);
+ return RecordBuilder.create(wrap(new RecordDefault<R>(bldr)), names, name);
}
-
+
private <C> Completion<C> wrap(
Completion<C> completion) {
if (wrapper != null) {
@@ -1488,7 +1488,7 @@ public class SchemaBuilder {
return completion;
}
}
-
+
/** FieldTypeBuilder adds {@link #unionOf()}, {@link #nullable()}, and {@link #optional()}
* to BaseFieldTypeBuilder. **/
public static final class FieldTypeBuilder<R> extends BaseFieldTypeBuilder<R> {
@@ -1496,7 +1496,7 @@ public class SchemaBuilder {
super(bldr, null);
}
- /** Build an Avro union schema type. **/
+ /** Build an Avro union schema type. **/
public UnionFieldTypeBuilder<R> unionOf() {
return new UnionFieldTypeBuilder<R>(bldr);
}
@@ -1537,7 +1537,7 @@ public class SchemaBuilder {
this.bldr = bldr;
this.names = bldr.names();
}
-
+
/**
* A plain boolean type without custom properties. This is equivalent to:
* <pre>
@@ -1573,7 +1573,7 @@ public class SchemaBuilder {
public IntBuilder<UnionAccumulator<IntDefault<R>>> intBuilder() {
return IntBuilder.create(completion(new IntDefault<R>(bldr)), names);
}
-
+
/**
* A plain long type without custom properties. This is equivalent to:
* <pre>
@@ -1682,31 +1682,31 @@ public class SchemaBuilder {
return NullBuilder.create(completion(new NullDefault<R>(bldr)), names);
}
- /** Build an Avro map type **/
+ /** Build an Avro map type **/
public MapBuilder<UnionAccumulator<MapDefault<R>>> map() {
return MapBuilder.create(completion(new MapDefault<R>(bldr)), names);
}
- /** Build an Avro array type **/
+ /** Build an Avro array type **/
public ArrayBuilder<UnionAccumulator<ArrayDefault<R>>> array() {
return ArrayBuilder.create(completion(new ArrayDefault<R>(bldr)), names);
}
- /** Build an Avro fixed type. **/
+ /** Build an Avro fixed type. **/
public FixedBuilder<UnionAccumulator<FixedDefault<R>>> fixed(String name) {
return FixedBuilder.create(completion(new FixedDefault<R>(bldr)), names, name);
}
-
- /** Build an Avro enum type. **/
+
+ /** Build an Avro enum type. **/
public EnumBuilder<UnionAccumulator<EnumDefault<R>>> enumeration(String name) {
return EnumBuilder.create(completion(new EnumDefault<R>(bldr)), names, name);
}
- /** Build an Avro record type. **/
+ /** Build an Avro record type. **/
public RecordBuilder<UnionAccumulator<RecordDefault<R>>> record(String name) {
- return RecordBuilder.create(completion(new RecordDefault<R>(bldr)), names, name);
+ return RecordBuilder.create(completion(new RecordDefault<R>(bldr)), names, name);
}
-
+
private <C> UnionCompletion<C> completion(Completion<C> context) {
return new UnionCompletion<C>(context, names, new ArrayList<Schema>());
}
@@ -1756,7 +1756,7 @@ public class SchemaBuilder {
public FieldBuilder<R> name(String fieldName) {
return new FieldBuilder<R>(this, names, fieldName);
}
-
+
/**
* Shortcut for creating a boolean field with the given name and no default.
* <p/>This is equivalent to:
@@ -1767,9 +1767,9 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredBoolean(String fieldName) {
return name(fieldName).type().booleanType().noDefault();
}
-
+
/**
- * Shortcut for creating an optional boolean field: a union of null and
+ * Shortcut for creating an optional boolean field: a union of null and
* boolean with null default.<p/>
* This is equivalent to:
* <pre>
@@ -1779,13 +1779,13 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalBoolean(String fieldName) {
return name(fieldName).type().optional().booleanType();
}
-
+
/**
* Shortcut for creating a nullable boolean field: a union of boolean and
* null with an boolean default.
* <p/>
* This is equivalent to:
- *
+ *
* <pre>
* name(fieldName).type().nullable().booleanType().booleanDefault(defaultVal)
* </pre>
@@ -1805,7 +1805,7 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredInt(String fieldName) {
return name(fieldName).type().intType().noDefault();
}
-
+
/**
* Shortcut for creating an optional int field: a union of null and int
* with null default.<p/>
@@ -1817,7 +1817,7 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalInt(String fieldName) {
return name(fieldName).type().optional().intType();
}
-
+
/**
* Shortcut for creating a nullable int field: a union of int and null
* with an int default.<p/>
@@ -1840,7 +1840,7 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredLong(String fieldName) {
return name(fieldName).type().longType().noDefault();
}
-
+
/**
* Shortcut for creating an optional long field: a union of null and long
* with null default.<p/>
@@ -1852,7 +1852,7 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalLong(String fieldName) {
return name(fieldName).type().optional().longType();
}
-
+
/**
* Shortcut for creating a nullable long field: a union of long and null
* with a long default.<p/>
@@ -1864,7 +1864,7 @@ public class SchemaBuilder {
public FieldAssembler<R> nullableLong(String fieldName, long defaultVal) {
return name(fieldName).type().nullable().longType().longDefault(defaultVal);
}
-
+
/**
* Shortcut for creating a float field with the given name and no default.
* <p/>This is equivalent to:
@@ -1875,7 +1875,7 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredFloat(String fieldName) {
return name(fieldName).type().floatType().noDefault();
}
-
+
/**
* Shortcut for creating an optional float field: a union of null and float
* with null default.<p/>
@@ -1887,7 +1887,7 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalFloat(String fieldName) {
return name(fieldName).type().optional().floatType();
}
-
+
/**
* Shortcut for creating a nullable float field: a union of float and null
* with a float default.<p/>
@@ -1910,7 +1910,7 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredDouble(String fieldName) {
return name(fieldName).type().doubleType().noDefault();
}
-
+
/**
* Shortcut for creating an optional double field: a union of null and double
* with null default.<p/>
@@ -1922,7 +1922,7 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalDouble(String fieldName) {
return name(fieldName).type().optional().doubleType();
}
-
+
/**
* Shortcut for creating a nullable double field: a union of double and null
* with a double default.<p/>
@@ -1934,7 +1934,7 @@ public class SchemaBuilder {
public FieldAssembler<R> nullableDouble(String fieldName, double defaultVal) {
return name(fieldName).type().nullable().doubleType().doubleDefault(defaultVal);
}
-
+
/**
* Shortcut for creating a string field with the given name and no default.
* <p/>This is equivalent to:
@@ -1945,7 +1945,7 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredString(String fieldName) {
return name(fieldName).type().stringType().noDefault();
}
-
+
/**
* Shortcut for creating an optional string field: a union of null and string
* with null default.<p/>
@@ -1957,7 +1957,7 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalString(String fieldName) {
return name(fieldName).type().optional().stringType();
}
-
+
/**
* Shortcut for creating a nullable string field: a union of string and null
* with a string default.<p/>
@@ -1980,7 +1980,7 @@ public class SchemaBuilder {
public FieldAssembler<R> requiredBytes(String fieldName) {
return name(fieldName).type().bytesType().noDefault();
}
-
+
/**
* Shortcut for creating an optional bytes field: a union of null and bytes
* with null default.<p/>
@@ -1992,7 +1992,7 @@ public class SchemaBuilder {
public FieldAssembler<R> optionalBytes(String fieldName) {
return name(fieldName).type().optional().bytesType();
}
-
+
/**
* Shortcut for creating a nullable bytes field: a union of bytes and null
* with a bytes default.<p/>
@@ -2018,12 +2018,12 @@ public class SchemaBuilder {
fields.add(field);
return this;
}
-
+
}
-
+
/**
* Builds a Field in the context of a {@link FieldAssembler}.
- *
+ *
* Usage is to first configure any of the optional parameters and then to call one
* of the type methods to complete the field. For example
* <pre>
@@ -2040,13 +2040,13 @@ public class SchemaBuilder {
super(names, name);
this.fields = fields;
}
-
+
/** Set this field to have ascending order. Ascending is the default **/
public FieldBuilder<R> orderAscending() {
order = Schema.Field.Order.ASCENDING;
return self();
}
-
+
/** Set this field to have decending order. Decending is the default **/
public FieldBuilder<R> orderDescending() {
order = Schema.Field.Order.DESCENDING;
@@ -2058,7 +2058,7 @@ public class SchemaBuilder {
order = Schema.Field.Order.IGNORE;
return self();
}
-
+
/**
* Final step in configuring this field, finalizing name, namespace, alias,
* and order.
@@ -2070,7 +2070,7 @@ public class SchemaBuilder {
/**
* Final step in configuring this field, finalizing name, namespace, alias,
- * and order. Sets the field's type to the provided schema, returns a
+ * and order. Sets the field's type to the provided schema, returns a
* {@link GenericDefault}.
*/
public GenericDefault<R> type(Schema type) {
@@ -2110,16 +2110,16 @@ public class SchemaBuilder {
Schema schema = names().get(name, namespace);
return type(schema);
}
-
+
private FieldAssembler<R> completeField(Schema schema, Object defaultVal) {
JsonNode defaultNode = toJsonNode(defaultVal);
return completeField(schema, defaultNode);
}
-
+
private FieldAssembler<R> completeField(Schema schema) {
return completeField(schema, null);
}
-
+
private FieldAssembler<R> completeField(Schema schema, JsonNode defaultVal) {
Field field = new Field(name(), schema, doc(), defaultVal, order);
addPropsTo(field);
@@ -2132,7 +2132,7 @@ public class SchemaBuilder {
return this;
}
}
-
+
/** Abstract base class for field defaults. **/
public static abstract class FieldDefault<R, S extends FieldDefault<R, S>> extends Completion<S> {
private final FieldBuilder<R> field;
@@ -2140,25 +2140,25 @@ public class SchemaBuilder {
FieldDefault(FieldBuilder<R> field) {
this.field = field;
}
-
+
/** Completes this field with no default value **/
public final FieldAssembler<R> noDefault() {
return field.completeField(schema);
}
-
+
private FieldAssembler<R> usingDefault(Object defaultVal) {
return field.completeField(schema, defaultVal);
}
-
+
@Override
final S complete(Schema schema) {
this.schema = schema;
return self();
}
-
+
abstract S self();
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class BooleanDefault<R> extends FieldDefault<R, BooleanDefault<R>> {
private BooleanDefault(FieldBuilder<R> field) {
@@ -2169,13 +2169,13 @@ public class SchemaBuilder {
public final FieldAssembler<R> booleanDefault(boolean defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final BooleanDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class IntDefault<R> extends FieldDefault<R, IntDefault<R>> {
private IntDefault(FieldBuilder<R> field) {
@@ -2186,13 +2186,13 @@ public class SchemaBuilder {
public final FieldAssembler<R> intDefault(int defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final IntDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class LongDefault<R> extends FieldDefault<R, LongDefault<R>> {
private LongDefault(FieldBuilder<R> field) {
@@ -2203,7 +2203,7 @@ public class SchemaBuilder {
public final FieldAssembler<R> longDefault(long defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final LongDefault<R> self() {
return this;
@@ -2220,7 +2220,7 @@ public class SchemaBuilder {
public final FieldAssembler<R> floatDefault(float defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final FloatDefault<R> self() {
return this;
@@ -2237,7 +2237,7 @@ public class SchemaBuilder {
public final FieldAssembler<R> doubleDefault(double defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final DoubleDefault<R> self() {
return this;
@@ -2254,7 +2254,7 @@ public class SchemaBuilder {
public final FieldAssembler<R> stringDefault(String defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final StringDefault<R> self() {
return this;
@@ -2266,24 +2266,24 @@ public class SchemaBuilder {
private BytesDefault(FieldBuilder<R> field) {
super(field);
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final FieldAssembler<R> bytesDefault(byte[] defaultVal) {
return super.usingDefault(ByteBuffer.wrap(defaultVal));
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final FieldAssembler<R> bytesDefault(ByteBuffer defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
/** Completes this field with the default value provided, cannot be null.
* The string is interpreted as a byte[], with each character code point
* value equalling the byte value, as in the Avro spec JSON default. **/
public final FieldAssembler<R> bytesDefault(String defaultVal) {
- return super.usingDefault(defaultVal);
+ return super.usingDefault(defaultVal);
}
-
+
@Override
final BytesDefault<R> self() {
return this;
@@ -2300,110 +2300,110 @@ public class SchemaBuilder {
public final FieldAssembler<R> nullDefault() {
return super.usingDefault(null);
}
-
+
@Override
final NullDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class MapDefault<R> extends FieldDefault<R, MapDefault<R>> {
private MapDefault(FieldBuilder<R> field) {
super(field);
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final <K, V> FieldAssembler<R> mapDefault(Map<K, V> defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final MapDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class ArrayDefault<R> extends FieldDefault<R, ArrayDefault<R>> {
private ArrayDefault(FieldBuilder<R> field) {
super(field);
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final <V> FieldAssembler<R> arrayDefault(List<V> defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final ArrayDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class FixedDefault<R> extends FieldDefault<R, FixedDefault<R>> {
private FixedDefault(FieldBuilder<R> field) {
super(field);
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final FieldAssembler<R> fixedDefault(byte[] defaultVal) {
return super.usingDefault(ByteBuffer.wrap(defaultVal));
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final FieldAssembler<R> fixedDefault(ByteBuffer defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
/** Completes this field with the default value provided, cannot be null.
* The string is interpreted as a byte[], with each character code point
* value equalling the byte value, as in the Avro spec JSON default. **/
public final FieldAssembler<R> fixedDefault(String defaultVal) {
- return super.usingDefault(defaultVal);
+ return super.usingDefault(defaultVal);
}
-
+
@Override
final FixedDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class EnumDefault<R> extends FieldDefault<R, EnumDefault<R>> {
private EnumDefault(FieldBuilder<R> field) {
super(field);
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final FieldAssembler<R> enumDefault(String defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final EnumDefault<R> self() {
return this;
}
}
-
+
/** Choose whether to use a default value for the field or not. **/
public static class RecordDefault<R> extends FieldDefault<R, RecordDefault<R>> {
private RecordDefault(FieldBuilder<R> field) {
super(field);
}
-
+
/** Completes this field with the default value provided, cannot be null **/
public final FieldAssembler<R> recordDefault(GenericRecord defaultVal) {
return super.usingDefault(defaultVal);
}
-
+
@Override
final RecordDefault<R> self() {
return this;
}
}
-
+
public final static class GenericDefault<R> {
private final FieldBuilder<R> field;
private final Schema schema;
@@ -2411,37 +2411,37 @@ public class SchemaBuilder {
this.field = field;
this.schema = schema;
}
-
+
/** Do not use a default value for this field. **/
public FieldAssembler<R> noDefault() {
return field.completeField(schema);
}
-
+
/** Completes this field with the default value provided.
* The value must conform to the schema of the field. **/
public FieldAssembler<R> withDefault(Object defaultVal) {
return field.completeField(schema, defaultVal);
}
}
-
- /**
+
+ /**
* Completion<R> is for internal builder use, all subclasses are private.
- *
+ *
* Completion is an object that takes a Schema and returns some result.
*/
private abstract static class Completion<R> {
abstract R complete(Schema schema);
}
-
+
private static class SchemaCompletion extends Completion<Schema> {
@Override
protected Schema complete(Schema schema) {
return schema;
}
}
-
+
private static final Schema NULL_SCHEMA = Schema.create(Schema.Type.NULL);
-
+
private static class NullableCompletion<R> extends Completion<R> {
private final Completion<R> context;
private NullableCompletion(Completion<R> context) {
@@ -2454,7 +2454,7 @@ public class SchemaBuilder {
return context.complete(nullable);
}
}
-
+
private static class OptionalCompletion<R> extends Completion<FieldAssembler<R>> {
private final FieldBuilder<R> bldr;
public OptionalCompletion(FieldBuilder<R> bldr) {
@@ -2467,11 +2467,11 @@ public class SchemaBuilder {
return bldr.completeField(optional, (Object)null);
}
}
-
+
private abstract static class CompletionWrapper {
abstract <R> Completion<R> wrap(Completion<R> completion);
}
-
+
private static final class NullableCompletionWrapper extends CompletionWrapper {
@Override
<R> Completion<R> wrap(Completion<R> completion) {
@@ -2539,7 +2539,7 @@ public class SchemaBuilder {
return new UnionAccumulator<R>(context, names, updated);
}
}
-
+
/** Accumulates all of the types in a union. Add an additional type with
* {@link #and()}. Complete the union with {@link #endUnion()}
*/
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
index dc1c9cc..8d73375 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
@@ -29,7 +29,7 @@ public interface SchemaValidationStrategy {
/**
* Validates that one schema is compatible with another.
- *
+ *
* @throws SchemaValidationException if the schemas are not compatible.
*/
void validate(Schema toValidate, Schema existing)
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
index 197c5c0..af85bac 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
@@ -36,7 +36,7 @@ public interface SchemaValidator {
* chronological order. This allows some validators to identify which schemas
* are the most "recent" in order to validate only against the mosst recent
* schema(s).
- *
+ *
* @param toValidate The schema to validate
* @param existing The schemas to validate against, in order from most recent to latest if applicable
* @throws SchemaValidationException if the schema fails to validate.
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
index e1563d2..5875435 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
@@ -57,17 +57,17 @@ public final class SchemaValidatorBuilder {
this.strategy = new ValidateMutualRead();
return this;
}
-
+
public SchemaValidator validateLatest() {
valid();
return new ValidateLatest(strategy);
}
-
+
public SchemaValidator validateAll() {
valid();
return new ValidateAll(strategy);
}
-
+
private void valid() {
if(null == strategy) {
throw new AvroRuntimeException("SchemaValidationStrategy not specified in builder");
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java b/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
index ed66aca..e875baf 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
@@ -22,7 +22,7 @@ package org.apache.avro;
public class UnresolvedUnionException extends AvroRuntimeException {
private Object unresolvedDatum;
private Schema unionSchema;
-
+
public UnresolvedUnionException(Schema unionSchema, Object unresolvedDatum) {
super("Not in union "+unionSchema+": "+unresolvedDatum);
this.unionSchema = unionSchema;
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
index 60d4b04..fed5a10 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
@@ -22,14 +22,14 @@ package org.apache.avro;
* A {@link SchemaValidationStrategy} that checks that the data written with the
* {@link Schema} to validate can be read by the existing schema according to
* the default Avro schema resolution rules.
- *
+ *
*/
class ValidateCanBeRead implements SchemaValidationStrategy {
/**
* Validate that data written with first schema provided can be read using the
* second schema, according to the default Avro schema resolution rules.
- *
+ *
* @throws SchemaValidationException
* if the second schema cannot read data written by the first.
*/
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
index bbf0c1e..7384eca 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
@@ -22,7 +22,7 @@ package org.apache.avro;
* A {@link SchemaValidationStrategy} that checks that the {@link Schema} to
* validate can read the existing schema according to the default Avro schema
* resolution rules.
- *
+ *
*/
class ValidateCanRead implements SchemaValidationStrategy {
@@ -30,7 +30,7 @@ class ValidateCanRead implements SchemaValidationStrategy {
* Validate that the first schema provided can be used to read data written
* with the second schema, according to the default Avro schema resolution
* rules.
- *
+ *
* @throws SchemaValidationException
* if the first schema cannot read data written by the second.
*/
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java b/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
index 5f8861e..e142b41 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
@@ -27,14 +27,14 @@ import org.apache.avro.io.parsing.Symbol;
* A {@link SchemaValidationStrategy} that checks that the {@link Schema} to
* validate and the existing schema can mutually read each other according to
* the default Avro schema resolution rules.
- *
+ *
*/
class ValidateMutualRead implements SchemaValidationStrategy {
/**
* Validate that the schemas provided can mutually read data written by each
* other according to the default Avro schema resolution rules.
- *
+ *
* @throws SchemaValidationException if the schemas are not mutually compatible.
*/
@Override
@@ -47,7 +47,7 @@ class ValidateMutualRead implements SchemaValidationStrategy {
/**
* Validates that data written with one schema can be read using another,
* based on the default Avro schema resolution rules.
- *
+ *
* @param writtenWith
* The "writer's" schema, representing data to be read.
* @param readUsing
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
index b55cfd0..e682acd 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
@@ -19,28 +19,28 @@ package org.apache.avro.data;
/** Interface for error builders */
public interface ErrorBuilder<T> extends RecordBuilder<T> {
-
+
/** Gets the value */
Object getValue();
-
+
/** Sets the value */
ErrorBuilder<T> setValue(Object value);
-
+
/** Checks whether the value has been set */
boolean hasValue();
-
+
/** Clears the value */
ErrorBuilder<T> clearValue();
-
+
/** Gets the error cause */
Throwable getCause();
-
+
/** Sets the error cause */
ErrorBuilder<T> setCause(Throwable cause);
-
+
/** Checks whether the cause has been set */
boolean hasCause();
-
+
/** Clears the cause */
ErrorBuilder<T> clearCause();
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/Json.java b/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
index 73a57c2..daa8482 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
@@ -73,7 +73,7 @@ public class Json {
if (!SCHEMA.equals(schema))
throw new RuntimeException("Not the Json schema: "+schema);
}
-
+
@Override
public void write(JsonNode datum, Encoder out) throws IOException {
Json.write(datum, out);
@@ -173,7 +173,7 @@ public class Json {
/** Note: this enum must be kept aligned with the union in Json.avsc. */
private enum JsonType { LONG, DOUBLE, STRING, BOOLEAN, NULL, ARRAY, OBJECT }
-
+
/**
* Write Json data as Avro data.
* @deprecated internal method
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
index 8c7a660..a01592c 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
@@ -22,7 +22,7 @@ package org.apache.avro.data;
public interface RecordBuilder<T> {
/**
* Constructs a new instance using the values set in the RecordBuilder.
- * If a particular value was not set and the schema defines a default
+ * If a particular value was not set and the schema defines a default
* value, the default value will be used.
* @return a new instance using values set in the RecordBuilder.
*/
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
index ca73b70..8e34a36 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
@@ -28,14 +28,14 @@ import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.IndexedRecord;
/** Abstract base class for RecordBuilder implementations. Not thread-safe. */
-public abstract class RecordBuilderBase<T extends IndexedRecord>
+public abstract class RecordBuilderBase<T extends IndexedRecord>
implements RecordBuilder<T> {
private static final Field[] EMPTY_FIELDS = new Field[0];
private final Schema schema;
private final Field[] fields;
private final boolean[] fieldSetFlags;
private final GenericData data;
-
+
protected final Schema schema() { return schema; }
protected final Field[] fields() { return fields; }
protected final boolean[] fieldSetFlags() { return fieldSetFlags; }
@@ -51,7 +51,7 @@ public abstract class RecordBuilderBase<T extends IndexedRecord>
fields = (Field[]) schema.getFields().toArray(EMPTY_FIELDS);
fieldSetFlags = new boolean[fields.length];
}
-
+
/**
* RecordBuilderBase copy constructor.
* Makes a deep copy of the values in the other builder.
@@ -65,17 +65,17 @@ public abstract class RecordBuilderBase<T extends IndexedRecord>
System.arraycopy(
other.fieldSetFlags, 0, fieldSetFlags, 0, fieldSetFlags.length);
}
-
+
/**
- * Validates that a particular value for a given field is valid according to
+ * Validates that a particular value for a given field is valid according to
* the following algorithm:
- * 1. If the value is not null, or the field type is null, or the field type
+ * 1. If the value is not null, or the field type is null, or the field type
* is a union which accepts nulls, returns.
* 2. Else, if the field has a default value, returns.
- * 3. Otherwise throws AvroRuntimeException.
+ * 3. Otherwise throws AvroRuntimeException.
* @param field the field to validate.
* @param value the value to validate.
- * @throws NullPointerException if value is null and the given field does
+ * @throws NullPointerException if value is null and the given field does
* not accept null values.
*/
protected void validate(Field field, Object value) {
@@ -92,7 +92,7 @@ public abstract class RecordBuilderBase<T extends IndexedRecord>
}
/**
- * Tests whether a value is valid for a specified field.
+ * Tests whether a value is valid for a specified field.
* @param f the field for which to test the value.
* @param value the value to test.
* @return true if the value is valid for the given field; false otherwise.
@@ -101,10 +101,10 @@ public abstract class RecordBuilderBase<T extends IndexedRecord>
if (value != null) {
return true;
}
-
+
Schema schema = f.schema();
Type type = schema.getType();
-
+
// If the type is null, any value is valid
if (type == Type.NULL) {
return true;
@@ -118,20 +118,20 @@ public abstract class RecordBuilderBase<T extends IndexedRecord>
}
}
}
-
+
// The value is null but the type does not allow nulls
return false;
}
-
+
/**
* Gets the default value of the given field, if any.
* @param field the field whose default value should be retrieved.
- * @return the default value associated with the given field,
+ * @return the default value associated with the given field,
* or null if none is specified in the schema.
- * @throws IOException
+ * @throws IOException
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- protected Object defaultValue(Field field) throws IOException {
+ protected Object defaultValue(Field field) throws IOException {
return data.deepCopy(field.schema(), data.getDefaultValue(field));
}
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java b/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
index 09cf623..8dccfc3 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
@@ -69,11 +69,11 @@ public class BZip2Codec extends Codec {
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int readCount = -1;
-
+
while ( (readCount = inputStream.read(buffer, compressedData.position(), buffer.length))> 0) {
baos.write(buffer, 0, readCount);
}
-
+
ByteBuffer result = ByteBuffer.wrap(baos.toByteArray());
return result;
} finally {
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java b/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
index af5e013..c27b4b7 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
@@ -20,7 +20,7 @@ package org.apache.avro.file;
import java.io.IOException;
import java.nio.ByteBuffer;
-/**
+/**
* Interface for Avro-supported compression codecs for data files.
*/
public abstract class Codec {
@@ -30,14 +30,14 @@ public abstract class Codec {
public abstract ByteBuffer compress(ByteBuffer uncompressedData) throws IOException;
/** Decompress the data */
public abstract ByteBuffer decompress(ByteBuffer compressedData) throws IOException;
- /**
+ /**
* Codecs must implement an equals() method. Two codecs, A and B are equal
* if: the result of A and B decompressing content compressed by A is the same
* AND the retult of A and B decompressing content compressed by B is the same
**/
@Override
public abstract boolean equals(Object other);
- /**
+ /**
* Codecs must implement a hashCode() method that is consistent with equals().*/
@Override
public abstract int hashCode();
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java b/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
index 6f25ea2..d178e13 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
@@ -67,11 +67,11 @@ public abstract class CodecFactory {
/** Creates internal Codec. */
protected abstract Codec createInstance();
-
- /** Mapping of string names (stored as metas) and codecs.
+
+ /** Mapping of string names (stored as metas) and codecs.
* Note that currently options (like compression level)
* are not recoverable. */
- private static final Map<String, CodecFactory> REGISTERED =
+ private static final Map<String, CodecFactory> REGISTERED =
new HashMap<String, CodecFactory>();
public static final int DEFAULT_DEFLATE_LEVEL = Deflater.DEFAULT_COMPRESSION;
@@ -103,7 +103,7 @@ public abstract class CodecFactory {
}
return o;
}
-
+
/** Adds a new codec implementation. If name already had
@@ -111,11 +111,11 @@ public abstract class CodecFactory {
public static CodecFactory addCodec(String name, CodecFactory c) {
return REGISTERED.put(name, c);
}
-
+
@Override
public String toString() {
Codec instance = this.createInstance();
return instance.toString();
}
-
+
}
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
index 4061962..265ac39 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
@@ -30,7 +30,7 @@ public class DataFileConstants {
};
public static final long FOOTER_BLOCK = -1;
public static final int SYNC_SIZE = 16;
- public static final int DEFAULT_SYNC_INTERVAL = 4000*SYNC_SIZE;
+ public static final int DEFAULT_SYNC_INTERVAL = 4000*SYNC_SIZE;
public static final String SCHEMA = "avro.schema";
public static final String CODEC = "avro.codec";
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
index be12574..0d5e5c1 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
@@ -59,7 +59,7 @@ public class DataFileReader<D>
return new DataFileReader<D>(in, reader);
if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format
return new DataFileReader12<D>(in, reader);
-
+
throw new IOException("Not an Avro data file");
}
@@ -166,7 +166,7 @@ public class DataFileReader<D>
return blockStart;
}
- /** Return true if past the next synchronization point after a position. */
+ /** Return true if past the next synchronization point after a position. */
@Override
public boolean pastSync(long position) throws IOException {
return ((blockStart >= position+SYNC_SIZE)||(blockStart >= sin.length()));
@@ -174,7 +174,7 @@ public class DataFileReader<D>
@Override public long tell() throws IOException { return sin.tell(); }
- static class SeekableInputStream extends InputStream
+ static class SeekableInputStream extends InputStream
implements SeekableInput {
private final byte[] oneByte = new byte[1];
private SeekableInput in;
@@ -182,7 +182,7 @@ public class DataFileReader<D>
SeekableInputStream(SeekableInput in) throws IOException {
this.in = in;
}
-
+
@Override
public void seek(long p) throws IOException {
if (p < 0)
@@ -204,7 +204,7 @@ public class DataFileReader<D>
public int read(byte[] b) throws IOException {
return in.read(b, 0, b.length);
}
-
+
@Override
public int read(byte[] b, int off, int len) throws IOException {
return in.read(b, off, len);
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
index 0194de0..54176df 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
@@ -39,7 +39,7 @@ public class DataFileReader12<D> implements FileReader<D>, Closeable {
};
private static final long FOOTER_BLOCK = -1;
private static final int SYNC_SIZE = 16;
- private static final int SYNC_INTERVAL = 1000*SYNC_SIZE;
+ private static final int SYNC_INTERVAL = 1000*SYNC_SIZE;
private static final String SCHEMA = "schema";
private static final String SYNC = "sync";
@@ -160,8 +160,8 @@ public class DataFileReader12<D> implements FileReader<D>, Closeable {
skipSync(); // skip a sync
blockCount = vin.readLong(); // read blockCount
-
- if (blockCount == FOOTER_BLOCK) {
+
+ if (blockCount == FOOTER_BLOCK) {
seek(vin.readLong()+in.tell()); // skip a footer
}
}
@@ -208,7 +208,7 @@ public class DataFileReader12<D> implements FileReader<D>, Closeable {
seek(in.length());
}
- /** Return true if past the next synchronization point after a position. */
+ /** Return true if past the next synchronization point after a position. */
@Override
public boolean pastSync(long position) throws IOException {
return ((blockStart >= position+SYNC_SIZE)||(blockStart >= in.length()));
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
index 458a7df..bfc53a0 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
@@ -74,8 +74,8 @@ public class DataFileStream<D> implements Iterator<D>, Iterable<D>, Closeable {
byte[] syncBuffer = new byte[DataFileConstants.SYNC_SIZE];
private Codec codec;
- /** Construct a reader for an input stream. For file-based input, use
- * {@link DataFileReader}. This will buffer, wrapping with a
+ /** Construct a reader for an input stream. For file-based input, use
+ * {@link DataFileReader}. This will buffer, wrapping with a
* {@link java.io.BufferedInputStream}
* is not necessary. */
public DataFileStream(InputStream in, DatumReader<D> reader)
@@ -90,7 +90,7 @@ public class DataFileStream<D> implements Iterator<D>, Iterable<D>, Closeable {
protected DataFileStream(DatumReader<D> reader) throws IOException {
this.reader = reader;
}
-
+
/** Initialize the stream by reading from its head. */
void initialize(InputStream in) throws IOException {
this.header = new Header();
@@ -118,7 +118,7 @@ public class DataFileStream<D> implements Iterator<D>, Iterable<D>, Closeable {
} while ((l = vin.mapNext()) != 0);
}
vin.readFixed(header.sync); // read sync
-
+
// finalize the header
header.metaKeyList = Collections.unmodifiableList(header.metaKeyList);
header.schema = Schema.parse(getMetaString(DataFileConstants.SCHEMA),false);
@@ -319,22 +319,22 @@ public class DataFileStream<D> implements Iterator<D>, Iterable<D>, Closeable {
this.numEntries = numEntries;
this.blockSize = blockSize;
}
-
+
DataBlock(ByteBuffer block, long numEntries) {
this.data = block.array();
this.blockSize = block.remaining();
this.offset = block.arrayOffset() + block.position();
this.numEntries = numEntries;
}
-
+
byte[] getData() {
return data;
}
-
+
long getNumEntries() {
return numEntries;
}
-
+
int getBlockSize() {
return blockSize;
}
@@ -346,23 +346,23 @@ public class DataFileStream<D> implements Iterator<D>, Iterable<D>, Closeable {
void setFlushOnWrite(boolean flushOnWrite) {
this.flushOnWrite = flushOnWrite;
}
-
+
ByteBuffer getAsByteBuffer() {
return ByteBuffer.wrap(data, offset, blockSize);
}
-
+
void decompressUsing(Codec c) throws IOException {
ByteBuffer result = c.decompress(getAsByteBuffer());
data = result.array();
blockSize = result.remaining();
}
-
+
void compressUsing(Codec c) throws IOException {
ByteBuffer result = c.compress(getAsByteBuffer());
data = result.array();
blockSize = result.remaining();
}
-
+
void writeBlockTo(BinaryEncoder e, byte[] sync) throws IOException {
e.writeLong(this.numEntries);
e.writeLong(this.blockSize);
@@ -372,7 +372,7 @@ public class DataFileStream<D> implements Iterator<D>, Iterable<D>, Closeable {
e.flush();
}
}
-
+
}
}
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
index 52fb895..fe916dc 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
@@ -77,16 +77,16 @@ public class DataFileWriter<D> implements Closeable, Flushable {
public DataFileWriter(DatumWriter<D> dout) {
this.dout = dout;
}
-
+
private void assertOpen() {
if (!isOpen) throw new AvroRuntimeException("not open");
}
private void assertNotOpen() {
if (isOpen) throw new AvroRuntimeException("already open");
}
-
- /**
- * Configures this writer to use the given codec.
+
+ /**
+ * Configures this writer to use the given codec.
* May not be reset after writes have begun.
*/
public DataFileWriter<D> setCodec(CodecFactory c) {
@@ -97,7 +97,7 @@ public class DataFileWriter<D> implements Closeable, Flushable {
}
/**
- * Set the synchronization interval for this file, in bytes.
+ * Set the synchronization interval for this file, in bytes.
* Valid values range from 32 to 2^30
* Suggested values are between 2K and 2M
*
@@ -108,12 +108,12 @@ public class DataFileWriter<D> implements Closeable, Flushable {
* called with param set to false, then the block may not be flushed to the
* stream after the sync marker is written. In this case,
* the {@linkplain #flush()} must be called to flush the stream.
- *
+ *
* Invalid values throw IllegalArgumentException
- *
- * @param syncInterval
+ *
+ * @param syncInterval
* the approximate number of uncompressed bytes to write in each block
- * @return
+ * @return
* this DataFileWriter
*/
public DataFileWriter<D> setSyncInterval(int syncInterval) {
@@ -251,7 +251,7 @@ public class DataFileWriter<D> implements Closeable, Flushable {
meta.put(key, value);
return this;
}
-
+
private DataFileWriter<D> setMetaInternal(String key, String value) {
try {
return setMetaInternal(key, value.getBytes("UTF-8"));
@@ -267,7 +267,7 @@ public class DataFileWriter<D> implements Closeable, Flushable {
}
return setMetaInternal(key, value);
}
-
+
public static boolean isReservedMeta(String key) {
return key.startsWith("avro.");
}
@@ -310,7 +310,7 @@ public class DataFileWriter<D> implements Closeable, Flushable {
blockCount++;
writeIfBlockFull();
}
-
+
// if there is an error encoding, flush the encoder and then
// reset the buffer position to contain size bytes, discarding the rest.
// Otherwise the file will be corrupt with a partial record.
@@ -330,7 +330,7 @@ public class DataFileWriter<D> implements Closeable, Flushable {
blockCount++;
writeIfBlockFull();
}
-
+
private int bufferInUse() {
return (buffer.size() + bufOut.bytesBuffered());
}
@@ -384,7 +384,7 @@ public class DataFileWriter<D> implements Closeable, Flushable {
}
}
}
-
+
private void writeBlock() throws IOException {
if (blockCount > 0) {
bufOut.flush();
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java b/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
index 2a0c8c5..f8f6ac4 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
@@ -26,8 +26,8 @@ import java.util.zip.DeflaterOutputStream;
import java.util.zip.Inflater;
import java.util.zip.InflaterOutputStream;
-/**
- * Implements DEFLATE (RFC1951) compression and decompression.
+/**
+ * Implements DEFLATE (RFC1951) compression and decompression.
*
* Note that there is a distinction between RFC1951 (deflate)
* and RFC1950 (zlib). zlib adds an extra 2-byte header
@@ -37,7 +37,7 @@ import java.util.zip.InflaterOutputStream;
* RFC1951.
*/
class DeflateCodec extends Codec {
-
+
static class Option extends CodecFactory {
private int compressionLevel;
@@ -55,7 +55,7 @@ class DeflateCodec extends Codec {
private Deflater deflater;
private Inflater inflater;
//currently only do 'nowrap' -- RFC 1951, not zlib
- private boolean nowrap = true;
+ private boolean nowrap = true;
private int compressionLevel;
public DeflateCodec(int compressionLevel) {
@@ -84,7 +84,7 @@ class DeflateCodec extends Codec {
ByteBuffer result = ByteBuffer.wrap(baos.toByteArray());
return result;
}
-
+
private void writeAndClose(ByteBuffer data, OutputStream to) throws IOException {
byte[] input = data.array();
int offset = data.arrayOffset() + data.position();
@@ -95,7 +95,7 @@ class DeflateCodec extends Codec {
to.close();
}
}
-
+
// get and initialize the inflater for use.
private Inflater getInflater() {
if (null == inflater) {
@@ -113,7 +113,7 @@ class DeflateCodec extends Codec {
deflater.reset();
return deflater;
}
-
+
// get and initialize the output buffer for use.
private ByteArrayOutputStream getOutputBuffer(int suggestedLength) {
if (null == outputBuffer) {
@@ -122,7 +122,7 @@ class DeflateCodec extends Codec {
outputBuffer.reset();
return outputBuffer;
}
-
+
@Override
public int hashCode() {
return nowrap ? 0 : 1;
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java b/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
index 19de11c..68c0102 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
@@ -40,7 +40,7 @@ public interface FileReader<D> extends Iterator<D>, Iterable<D>, Closeable {
* #next()}. */
void sync(long position) throws IOException;
- /** Return true if past the next synchronization point after a position. */
+ /** Return true if past the next synchronization point after a position. */
boolean pastSync(long position) throws IOException;
/** Return the current position in the input. */
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java b/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
index fd82d9b..e95f699 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
@@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
/** Implements "null" (pass through) codec. */
final class NullCodec extends Codec {
-
+
private static final NullCodec INSTANCE = new NullCodec();
static class Option extends CodecFactory {
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java b/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
index 0787050..1a5d252 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
@@ -60,15 +60,15 @@ class SnappyCodec extends Codec {
int size = Snappy.uncompress(in.array(),in.position(),in.remaining()-4,
out.array(), 0);
out.limit(size);
-
+
crc32.reset();
crc32.update(out.array(), 0, size);
if (in.getInt(in.limit()-4) != (int)crc32.getValue())
throw new IOException("Checksum failure");
-
+
return out;
}
-
+
@Override public int hashCode() { return getName().hashCode(); }
@Override
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
index 40b7e0f..e69e4ef 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
@@ -26,7 +26,7 @@ public interface GenericArray<T> extends List<T>, GenericContainer {
* store an element, if any. This permits reuse of arrays and their elements
* without allocating new objects. */
T peek();
-
+
/** Reverses the order of the elements in this array. */
void reverse();
}
http://git-wip-us.apache.org/repos/asf/avro/blob/da22ffcb/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
index 2b01de4..09f4c5a 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
@@ -60,7 +60,7 @@ import com.google.common.collect.MapMaker;
public class GenericData {
private static final GenericData INSTANCE = new GenericData();
-
+
/** Used to specify the Java type for a string schema. */
public enum StringType { CharSequence, String, Utf8 };
@@ -322,12 +322,12 @@ public class GenericData {
public void reverse() {
int left = 0;
int right = elements.length - 1;
-
+
while (left < right) {
Object tmp = elements[left];
elements[left] = elements[right];
elements[right] = tmp;
-
+
left++;
right--;
}
@@ -526,7 +526,7 @@ public class GenericData {
toString(element, buffer);
if (i++ < last)
buffer.append(", ");
- }
+ }
buffer.append("]");
} else if (isMap(datum)) {
buffer.append("{");
@@ -561,7 +561,7 @@ public class GenericData {
buffer.append(datum);
}
}
-
+
/* Adapted from http://code.google.com/p/json-simple */
private void writeEscapedString(CharSequence string, StringBuilder builder) {
for(int i = 0; i < string.length(); i++){
@@ -658,7 +658,7 @@ public class GenericData {
public void setField(Object record, String name, int position, Object o) {
((IndexedRecord)record).put(position, o);
}
-
+
/** Called by {@link GenericDatumReader#readRecord} to retrieve a record
* field value from a reused instance. The default implementation is for
* {@link IndexedRecord}.*/
@@ -675,7 +675,7 @@ public class GenericData {
protected void setField(Object r, String n, int p, Object o, Object state) {
setField(r, n, p, o);
}
-
+
/** Version of {@link #getField} that has state. */
protected Object getField(Object record, String name, int pos, Object state) {
return getField(record, name, pos);
@@ -798,7 +798,7 @@ public class GenericData {
protected boolean isEnum(Object datum) {
return datum instanceof GenericEnumSymbol;
}
-
+
/** Called to obtain the schema of a enum. By default calls
* {GenericContainer#getSchema(). May be overridden for alternate enum
* representations. */
@@ -810,7 +810,7 @@ public class GenericData {
protected boolean isMap(Object datum) {
return datum instanceof Map;
}
-
+
/** Called by the default implementation of {@link #instanceOf}.*/
protected boolean isFixed(Object datum) {
return datum instanceof GenericFixed;
@@ -867,7 +867,7 @@ public class GenericData {
protected boolean isBoolean(Object datum) {
return datum instanceof Boolean;
}
-
+
/** Compute a hash code according to a schema, consistent with {@link
* #compare(Object,Object,Schema)}. */
@@ -974,11 +974,11 @@ public class GenericData {
/**
* Gets the default value of the given field, if any.
* @param field the field whose default value should be retrieved.
- * @return the default value associated with the given field,
+ * @return the default value associated with the given field,
* or null if none is specified in the schema.
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
- public Object getDefaultValue(Field field) {
+ public Object getDefaultValue(Field field) {
JsonNode json = field.defaultValue();
if (json == null)
throw new AvroRuntimeException("Field " + field
@@ -989,10 +989,10 @@ public class GenericData {
&& field.schema().getTypes().get(0).getType() == Type.NULL))) {
return null;
}
-
+
// Check the cache
Object defaultValue = defaultValueCache.get(field);
-
+
// If not cached, get the default Java value by encoding the default JSON
// value and then decoding it:
if (defaultValue == null)
@@ -1060,7 +1060,7 @@ public class GenericData {
return value; // immutable
case MAP:
Map<CharSequence, Object> mapValue = (Map) value;
- Map<CharSequence, Object> mapCopy =
+ Map<CharSequence, Object> mapCopy =
new HashMap<CharSequence, Object>(mapValue.size());
for (Map.Entry<CharSequence, Object> entry : mapValue.entrySet()) {
mapCopy.put((CharSequence)(deepCopy(STRINGS, entry.getKey())),
@@ -1086,11 +1086,11 @@ public class GenericData {
if (value instanceof String) {
return (T)value;
}
-
- // Some CharSequence subclasses are mutable, so we still need to make
+
+ // Some CharSequence subclasses are mutable, so we still need to make
// a copy
else if (value instanceof Utf8) {
- // Utf8 copy constructor is more efficient than converting
+ // Utf8 copy constructor is more efficient than converting
// to string and then back to Utf8
return (T)new Utf8((Utf8)value);
}
@@ -1104,7 +1104,7 @@ public class GenericData {
value + "\"");
}
}
-
+
/** Called to create an fixed value. May be overridden for alternate fixed
* representations. By default, returns {@link GenericFixed}. */
public Object createFixed(Object old, Schema schema) {
@@ -1113,7 +1113,7 @@ public class GenericData {
return old;
return new GenericData.Fixed(schema);
}
-
+
/** Called to create an fixed value. May be overridden for alternate fixed
* representations. By default, returns {@link GenericFixed}. */
public Object createFixed(Object old, byte[] bytes, Schema schema) {
@@ -1121,7 +1121,7 @@ public class GenericData {
System.arraycopy(bytes, 0, fixed.bytes(), 0, schema.getFixedSize());
return fixed;
}
-
+
/** Called to create an enum value. May be overridden for alternate enum
* representations. By default, returns a GenericEnumSymbol. */
public Object createEnum(String symbol, Schema schema) {
@@ -1144,5 +1144,5 @@ public class GenericData {
}
return new GenericData.Record(schema);
}
-
+
}