Ignore:
Timestamp:
06/26/13 13:27:31 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • use java annotations to mark classes and fields to be used when:
    • using java classes with ReflectionAccess? to represent remote objects with FramsClass? description found by "info ..." requests
    • to build up FramsClass? representation of objects not present at remote server
  • allow using primitive types (instead of wraping counterparts) in reflected classes
  • rework FramsClass? creation process (add FramsClassBuilder?)
  • add more tests

CHANGELOG:
Prepare model.World class.

Minor change.

Use primitive types for Genotype and Creature classes.

Use primitive types in model.Neuro* classes.

Use primitive types in model.Joint* classes.

Use primitive types in model.Part* classes.

Fix primitive values.

Extract FramsClassBuilder?.

Add tests of Model classes.

More fixes.

Refactorize out ParamCandidate?.

Several fixes.

Fix all regressions after introducing annotations.

Use annotations throughout the project.

Add exception classes.

Improve creation of FramsClass?.

More changes.

Many changes regarding annotations.

Annotate classes in com.framsticks.model package.

Remove manual FramsClass? constructor.

Construct FramsClass? for Creature. Add test.

Add default values to the ParamAnnotation?.

Add ParamBuilderTest? and ParamAnnotation?.

Add FramsClassAnnotation?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/params/Registry.java

    r84 r86  
    22
    33import org.apache.log4j.Logger;
     4
     5import com.framsticks.params.annotations.FramsClassAnnotation;
    46
    57import java.util.HashMap;
     
    3537        }
    3638
    37         public AccessInterface createAccess(String name, FramsClass framsClass) {
     39        public Registry register(Class<?> reflectedClass) {
     40                FramsClassAnnotation a = reflectedClass.getAnnotation(FramsClassAnnotation.class);
     41                if (a == null) {
     42                        log.error("class is not annotated: " + reflectedClass);
     43                        return this;
     44                }
     45
     46                registerReflectedClass(FramsClassBuilder.getName(a, reflectedClass), FramsClassBuilder.getId(a, reflectedClass), reflectedClass);
     47
     48                return this;
     49        }
     50
     51        public AccessInterface createAccess(String name, FramsClass framsClass) throws ConstructionException {
    3852                if (reflectedClasses.containsKey(name)) {
    3953                        return new ReflectionAccess(reflectedClasses.get(name), framsClass);
     
    6680
    6781        public static AccessInterface wrapAccessWithListIfNeeded(CompositeParam param, AccessInterface access) {
    68         if (access == null) {
     82                if (access == null) {
    6983                        return null;
    7084                }
    71         return param.prepareAccessInterface(access);
     85                return param.prepareAccessInterface(access);
    7286        }
    7387
    74     public AccessInterface prepareAccess(CompositeParam param) {
    75         return wrapAccessWithListIfNeeded(param, createAccess(param.getContainedTypeName()));
    76     }
     88        public AccessInterface prepareAccess(CompositeParam param) throws ConstructionException {
     89                return wrapAccessWithListIfNeeded(param, createAccess(param.getContainedTypeName()));
     90        }
    7791
    78         public AccessInterface createAccess(String name) {
     92        public AccessInterface createAccess(String name) throws ConstructionException {
    7993                if (name == null) {
    8094                        return null;
Note: See TracChangeset for help on using the changeset viewer.