Missing @Overrides, extra imports
This commit is contained in:
@@ -23,7 +23,6 @@ package com.samskivert.depot;
|
|||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -32,22 +31,18 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.common.collect.Interner;
|
||||||
|
import com.google.common.collect.Interners;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import com.samskivert.util.ByteEnum;
|
import com.samskivert.util.ByteEnum;
|
||||||
import com.samskivert.util.ByteEnumUtil;
|
import com.samskivert.util.ByteEnumUtil;
|
||||||
|
|
||||||
import com.samskivert.depot.annotation.Column;
|
import com.samskivert.depot.annotation.Column;
|
||||||
import com.samskivert.depot.annotation.Transform;
|
import com.samskivert.depot.annotation.Transform;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Interner;
|
|
||||||
import com.google.common.collect.Interners;
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains various generally useful {@link Transformer} implementations. To use a transformer, you
|
* Contains various generally useful {@link Transformer} implementations. To use a transformer, you
|
||||||
* specify it via a {@link Column} annotation. For example:
|
* specify it via a {@link Column} annotation. For example:
|
||||||
@@ -97,12 +92,12 @@ public class Transformers
|
|||||||
*/
|
*/
|
||||||
public static class StringArray extends StringBase<String[]>
|
public static class StringArray extends StringBase<String[]>
|
||||||
{
|
{
|
||||||
protected Iterable<String> asIterable (String[] value)
|
@Override protected Iterable<String> asIterable (String[] value)
|
||||||
{
|
{
|
||||||
return Arrays.asList(value);
|
return Arrays.asList(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Builder<String[]> createBuilder (String encoded)
|
@Override protected Builder<String[]> createBuilder (String encoded)
|
||||||
{
|
{
|
||||||
// jog through and count the elements so that we can populate the array directly
|
// jog through and count the elements so that we can populate the array directly
|
||||||
final String[] result = new String[countElements(encoded)];
|
final String[] result = new String[countElements(encoded)];
|
||||||
@@ -126,12 +121,12 @@ public class Transformers
|
|||||||
*/
|
*/
|
||||||
public static class StringIterable extends StringBase<Iterable<String>>
|
public static class StringIterable extends StringBase<Iterable<String>>
|
||||||
{
|
{
|
||||||
protected Iterable<String> asIterable (Iterable<String> value)
|
@Override protected Iterable<String> asIterable (Iterable<String> value)
|
||||||
{
|
{
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Builder<Iterable<String>> createBuilder (String encoded)
|
@Override protected Builder<Iterable<String>> createBuilder (String encoded)
|
||||||
{
|
{
|
||||||
Collection<String> adder;
|
Collection<String> adder;
|
||||||
Collection<String> retval = null;
|
Collection<String> retval = null;
|
||||||
@@ -200,7 +195,7 @@ public class Transformers
|
|||||||
if (s == null) {
|
if (s == null) {
|
||||||
buf.append("\\\n"); // encode nulls as slash followed by the terminator
|
buf.append("\\\n"); // encode nulls as slash followed by the terminator
|
||||||
} else {
|
} else {
|
||||||
s = s.replace("\\", "\\\\"); // turn \ into \\
|
s = s.replace("\\", "\\\\"); // turn \ into \\
|
||||||
s = s.replace("\n", "\\n"); // turn a newline in a String to "\n"
|
s = s.replace("\n", "\\n"); // turn a newline in a String to "\n"
|
||||||
buf.append(s).append('\n');
|
buf.append(s).append('\n');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ public class TransformTest extends TestBase
|
|||||||
|
|
||||||
public static class CustomTypeTransformer extends Transformer<CustomType, String>
|
public static class CustomTypeTransformer extends Transformer<CustomType, String>
|
||||||
{
|
{
|
||||||
public String toPersistent (CustomType value) {
|
@Override public String toPersistent (CustomType value) {
|
||||||
return value.value;
|
return value.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomType fromPersistent (String value) {
|
@Override public CustomType fromPersistent (String value) {
|
||||||
return new CustomType(value);
|
return new CustomType(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,10 +116,10 @@ public class TransformTest extends TestBase
|
|||||||
@SuppressWarnings("unchecked") Class<Dummy> eclass = (Class<Dummy>)ftype;
|
@SuppressWarnings("unchecked") Class<Dummy> eclass = (Class<Dummy>)ftype;
|
||||||
_eclass = eclass;
|
_eclass = eclass;
|
||||||
}
|
}
|
||||||
public Short toPersistent (ShortEnum value) {
|
@Override public Short toPersistent (ShortEnum value) {
|
||||||
return value.toShort();
|
return value.toShort();
|
||||||
}
|
}
|
||||||
public ShortEnum fromPersistent (Short value) {
|
@Override public ShortEnum fromPersistent (Short value) {
|
||||||
return fromShort(_eclass, value);
|
return fromShort(_eclass, value);
|
||||||
}
|
}
|
||||||
private enum Dummy implements ShortEnum {
|
private enum Dummy implements ShortEnum {
|
||||||
|
|||||||
Reference in New Issue
Block a user