- Timestamp:
- 07/08/13 23:04:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/core/ObjectTree.java
r97 r98 8 8 import com.framsticks.params.Param; 9 9 import com.framsticks.params.PrimitiveParam; 10 import com.framsticks.params.ValueParam; 10 11 import com.framsticks.params.annotations.AutoAppendAnnotation; 11 12 import com.framsticks.params.annotations.FramsClassAnnotation; 12 import com.framsticks.util.UnsupportedOperationException;13 13 import com.framsticks.params.types.ProcedureParam; 14 14 import com.framsticks.util.FramsticksException; 15 15 import com.framsticks.util.dispatching.Future; 16 16 17 import static com.framsticks.core.TreeOperations.*; 17 18 … … 24 25 registry.registerAndBuild(object.getClass()); 25 26 AccessInterface access = registry.createAccess(object.getClass()); 26 setRoot(new Node(Param.build().forAccess(access).id(getName()).finish(CompositeParam.class), object)); 27 assignRootParam(Param.build().forAccess(access).id(getName()).finish(CompositeParam.class)); 28 assignRootObject(object); 27 29 } 28 30 29 31 public Object getRootObject() { 30 return get Root().getObject();32 return getAssignedRoot().getObject(); 31 33 } 32 34 … … 43 45 44 46 @Override 45 public void get( final Path path, Mode mode, Future<Object> future) {47 public void get(Path path, Mode mode, Future<Path> future) { 46 48 assert isActive(); 47 49 log.debug("requesting: " + path); 48 fireFetch(path);49 future.pass(path .getTopObject());50 path = resolveTopSync(path); 51 future.pass(path); 50 52 } 51 53 52 54 @Override 53 public void get(Path path, PrimitiveParam<?>param, Mode mode, Future<Object> future) {55 public void get(Path path, ValueParam param, Mode mode, Future<Object> future) { 54 56 assert isActive(); 55 fireFetch(path);57 path = resolveTopSync(path); 56 58 future.pass(bindAccess(path).get(param, Object.class)); 57 59 } … … 80 82 } 81 83 82 @Override 83 public void resolve(Path path, Future<Path> future) { 84 protected Path resolveTopSync(Path path) { 84 85 assert isActive(); 85 86 assert path.isOwner(this); 86 87 if (path.getTop().getObject() != null) { 87 future.pass(path); 88 return; 88 return path; 89 89 } 90 AccessInterface access = bindAccess( this,path.getUnder());90 AccessInterface access = bindAccess(path.getUnder()); 91 91 Object object = access.get(path.getTop().getParam(), Object.class); 92 92 if (object == null) { 93 future.pass(path); 94 return; 93 return path; 95 94 } 96 future.pass(path.appendResolution(object));95 return path.appendResolution(object); 97 96 } 97 98 98 99 99 @Override … … 103 103 } 104 104 105 @Override106 public Path create(Path path) {107 assert isActive();108 assert !path.isResolved();109 throw new UnsupportedOperationException();110 }111 112 105 }
Note: See TracChangeset
for help on using the changeset viewer.