Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Updated dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkJeongHwan committed Sep 9, 2019
1 parent 54eae08 commit fb10283
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 142 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repositories {
}

dependencies {

compile 'com.github.realtimetech-solution:reflection:0.1.1'
}

jar {
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/com/realtimetech/kson/KsonContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import com.realtimetech.kson.element.KsonObject;
import com.realtimetech.kson.element.KsonValue;
import com.realtimetech.kson.primary.PrimaryKey;
import com.realtimetech.kson.reflection.ArrayUtils;
import com.realtimetech.kson.reflection.UnsafeAllocator;
import com.realtimetech.kson.stack.FastStack;
import com.realtimetech.kson.string.StringMaker;
import com.realtimetech.kson.transform.Transformer;
import com.realtimetech.reflection.access.ArrayAccessor;
import com.realtimetech.reflection.allocate.UnsafeAllocator;

@SuppressWarnings("unchecked")
public class KsonContext {
Expand All @@ -34,7 +34,6 @@ private enum ValueMode {
// for object
private FastStack<Object> objectStack;
private FastStack<KsonValue> ksonStack;
private UnsafeAllocator unsafeAllocator;

private HashMap<Class<?>, Transformer<?>> registeredTransformers;

Expand All @@ -51,8 +50,6 @@ public KsonContext() {
this.stringMaker = new StringMaker(100);

this.objectStack = new FastStack<Object>();
this.ksonStack = new FastStack<KsonValue>();
this.unsafeAllocator = UnsafeAllocator.create();

this.registeredTransformers = new HashMap<Class<? extends Object>, Transformer<? extends Object>>();

Expand Down Expand Up @@ -273,7 +270,7 @@ public Object addToObjectStack(Class<?> clazz, Object object) throws Exception {
arrayComponentType = targetObjectClass;
}

ArrayUtils.set(targetObject, index, createAtToObject(false, arrayComponentType, ksonValue.get(index)));
ArrayAccessor.set(targetObject, index, createAtToObject(false, arrayComponentType, ksonValue.get(index)));
}
}
}
Expand Down Expand Up @@ -330,7 +327,7 @@ private Object createAtToObject(boolean first, Class<?> type, Object originalVal
convertedValue = Array.newInstance(componentType, ksonArray.size());
} else if (convertedValue instanceof KsonObject) {
if (primaryId == null) {
convertedValue = this.unsafeAllocator.newInstance(type);
convertedValue = UnsafeAllocator.newInstance(type);
} else {
if (!this.primaryObjects.containsKey(type)) {
this.primaryObjects.put(type, new HashMap<Object, Object>());
Expand All @@ -339,7 +336,7 @@ private Object createAtToObject(boolean first, Class<?> type, Object originalVal
HashMap<Object, Object> hashMap = this.primaryObjects.get(type);

if (!hashMap.containsKey(primaryId)) {
hashMap.put(primaryId, this.unsafeAllocator.newInstance(type));
hashMap.put(primaryId, UnsafeAllocator.newInstance(type));
}

convertedValue = hashMap.get(primaryId);
Expand Down Expand Up @@ -393,7 +390,7 @@ public Object addFromObjectStack(Object object) throws IOException, IllegalArgum
arrayComponentType = targetObject.getClass();
}

ksonValue.add(this.createAtFromObject(false, arrayComponentType, ArrayUtils.get(targetObject, index)));
ksonValue.add(this.createAtFromObject(false, arrayComponentType, ArrayAccessor.get(targetObject, index)));
}
}
}
Expand Down
50 changes: 0 additions & 50 deletions src/main/java/com/realtimetech/kson/reflection/ArrayUtils.java

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/java/com/realtimetech/kson/test/TestObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.List;
import java.util.Map;

import com.realtimetech.kson.reflection.ArrayUtils;
import com.realtimetech.reflection.access.ArrayAccessor;

public class TestObject {
private Test test;
Expand Down Expand Up @@ -62,8 +62,8 @@ private boolean validation(Object originalObject, Object targetObject) {

if (originalLength == targetLength) {
for (int index = 0; index < originalLength; index++) {
Object originalElementObject = ArrayUtils.get(originalObject, index);
Object targetElementObject = ArrayUtils.get(targetObject, index);
Object originalElementObject = ArrayAccessor.get(originalObject, index);
Object targetElementObject = ArrayAccessor.get(targetObject, index);

if (originalElementObject.getClass() != targetElementObject.getClass()) {
return false;
Expand Down

0 comments on commit fb10283

Please sign in to comment.