Skip to content

Commit

Permalink
Merge pull request #49 from yahoo/cleanup-javadoc
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
Dennis McWherter committed Nov 16, 2015
2 parents b5f6477 + 0ee6966 commit 18c212a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ private void bindAttrOrRelation(Class<?> cls, AccessibleObject fieldOrMethod) {

/**
* Returns name of field whether public member or method
* @param fieldOrMethod
* @return
* @param fieldOrMethod field or method
* @return field or method name
*/
private static String getFieldName(AccessibleObject fieldOrMethod) {
if (fieldOrMethod instanceof Field) {
Expand All @@ -242,8 +242,8 @@ private static String getFieldName(AccessibleObject fieldOrMethod) {

/**
* Returns type of field whether public member or method
* @param fieldOrMethod
* @return
* @param fieldOrMethod field or method
* @return field type
*/
private static Class<?> getFieldType(AccessibleObject fieldOrMethod) {
if (fieldOrMethod instanceof Field) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public String getId(Object value) {
/**
* Returns type of id field
* @param entityClass the entity class
* @return
* @return ID type
*/
public Class<?> getIdType(Class<?> entityClass) {
return entityBinding(entityClass).getIdType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* See: http://jsonapi.org/extensions/jsonpatch/
*/
public class JsonApiPatch {
private class PatchAction {
private static class PatchAction {
public final Patch patch;

// Failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class CoerceUtil {
* Convert value to target class
* @param value value to convert
* @param cls class to convert to
* @return
* @return coerced value
*/
public static Object coerce(Object value, Class<?> cls) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public class ToEnumConverter implements Converter {
* Convert value to Enum
* @param cls enum to convert to
* @param value value to convert
* @param <T>
* @return
* @param <T> enum type
* @return enum
*/
@Override
public <T> T convert(Class<T> cls, Object value) {
Expand All @@ -41,9 +41,9 @@ public <T> T convert(Class<T> cls, Object value) {
* Convert digit to enum
* @param cls enum to convert to
* @param value value to convert
* @param <T>
* @return
* @throws ReflectiveOperationException
* @param <T> enum type
* @return enum
* @throws ReflectiveOperationException reflection exception
*/
private <T> T intToEnum(Class<?> cls, Integer value) throws ReflectiveOperationException {
Object[] values = (Object[]) cls.getMethod("values").invoke(null, (Object[]) null);
Expand All @@ -54,8 +54,8 @@ private <T> T intToEnum(Class<?> cls, Integer value) throws ReflectiveOperationE
* Convert string to enum
* @param cls enum to convert to
* @param value value to convert
* @param <T>
* @return
* @param <T> enum type
* @return enum
*/
private <T> T stringToEnum(Class<?> cls, String value) {
Enum e = Enum.valueOf((Class<Enum>) cls, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class UserTest {
private final EntityDictionary dictionary = new EntityDictionary();
private final Logger testLogger = new TestLogger();

public class CounterCheck implements Check {
public static class CounterCheck implements Check {
public int callCounter = 0;
@Override
public boolean ok(PersistentResource resource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;

Expand Down Expand Up @@ -111,8 +112,8 @@ public void commit() {
@Override
public <T> T createObject(Class<T> entityClass) {
if (database.get(entityClass) == null) {
database.put(entityClass, new ConcurrentHashMap<>());
TYPEIDS.put(entityClass, new AtomicLong(1));
database.putIfAbsent(entityClass, new ConcurrentHashMap<>());
TYPEIDS.putIfAbsent(entityClass, new AtomicLong(1));
}
AtomicLong idValue = TYPEIDS.get(entityClass);
String id = String.valueOf(idValue.getAndIncrement());
Expand Down Expand Up @@ -261,10 +262,10 @@ public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Database contents ");
for (Class<?> cls : database.keySet()) {
sb.append("\n Table " + cls + " contents \n");
sb.append("\n Table ").append(cls).append(" contents \n");
ConcurrentHashMap<String, Object> data = database.get(cls);
for (String id : data.keySet()) {
sb.append(" Id: " + id + " Value: " + data.get(id.toString()));
for (Entry<String, Object> e : data.entrySet()) {
sb.append(" Id: ").append(e.getKey()).append(" Value: ").append(e.getValue());
}
}
return sb.toString();
Expand Down

0 comments on commit 18c212a

Please sign in to comment.