コード例 #1
0
  SimpleTypeMappingImpl(ClassTypeInfo typeInfo, PropertyMetaType<I> propertyMetaType) {

    ClassTypeInfo stp =
        (ClassTypeInfo) SimpleTypeResolver.typeDomain.resolve(SimpleTypeProvider.class);
    TypeVariableInfo tvi = stp.getTypeParameters().get(1); // <E>
    TypeInfo aaa = typeInfo.resolve(tvi);

    //
    this.propertyMetaType = propertyMetaType;
    this.typeInfo = typeInfo;
    this.external = aaa;
  }
コード例 #2
0
  SimpleTypeMappingImpl(ClassTypeInfo typeInfo) {

    // Find the right subclass
    ClassTypeInfo current = typeInfo;
    while (!current.getSuperClass().getName().equals(SimpleTypeProvider.class.getName())) {
      current = current.getSuperClass();
    }

    //
    ClassTypeInfo stp =
        (ClassTypeInfo) SimpleTypeResolver.typeDomain.resolve(SimpleTypeProvider.class);
    TypeVariableInfo tvi = stp.getTypeParameters().get(1); // <E>
    TypeInfo aaa = typeInfo.resolve(tvi);
    //    if (!aaa.equals(typeInfo)) {
    //      throw new AssertionError(aaa + " should be equals to " + typeInfo);
    //    }

    //
    PropertyMetaType aaaaa = propertyMetaTypes.get(current);

    //
    this.propertyMetaType = aaaaa;
    this.typeInfo = typeInfo;
    this.external = aaa;
  }
コード例 #3
0
 public SimpleTypeProvider<I, ?> create() {
   if (instance == null) {
     Class type = (Class) typeInfo.unwrap();
     try {
       instance = (SimpleTypeProvider<I, ?>) type.newInstance();
     } catch (InstantiationException e) {
       throw new AssertionError(e);
     } catch (IllegalAccessException e) {
       throw new AssertionError(e);
     }
   }
   return instance;
 }