Examples of EvaluatedType


Examples of org.glassfish.gmbal.typelib.EvaluatedType

        return m.method();
    } } ) ;

  try {
      final String desc = mom.getDescription(m);
      final EvaluatedType rtype = m.returnType();
      final TypeConverter rtc = rtype == null ? null : mom.getTypeConverter(
    rtype);
      final List<EvaluatedType> atypes = m.parameterTypes();
      final List<TypeConverter> atcs = new ArrayList<TypeConverter>();
      final ManagedOperation mo = mom.getAnnotation(m.element(),
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

    }

    private static Pair<AttributeType,EvaluatedType> getTypeInfo(
        EvaluatedDeclaration decl ) {

        EvaluatedType evalType = null ;
        AttributeType atype = null ;
        if (decl instanceof EvaluatedMethodDeclaration) {
            EvaluatedMethodDeclaration method =
                (EvaluatedMethodDeclaration)decl ;
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

        if (type instanceof EvaluatedClassDeclaration) {
      return ((EvaluatedClassDeclaration)type).cls() ;
  } else if (type instanceof EvaluatedArrayType) {
      // Same trick as above.
      final EvaluatedArrayType gat = (EvaluatedArrayType)type ;
      final EvaluatedType ctype = canonicalType( gat.componentType() ) ;
      final Class cclass = getJavaClass( ctype ) ;
      final Object temp = Array.newInstance( cclass, 0 ) ;
      return temp.getClass() ;
  } else {
            throw Exceptions.self.cannotConvertToJavaType(type) ;
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

    }

    private static TypeConverter handleSimpleType( final EvaluatedType type,
  final OpenType stype ) {

        final EvaluatedType canType = canonicalType( type ) ;

  return new TypeConverterImpl( type, stype ) {
      public Object toManagedEntity( final Object obj ) {
    return obj ;
      }

            @Override
      public Object fromManagedEntity( final Object entity ) {
    return entity ;
      }

            @Override
      public boolean isIdentity() {
    return canType.equals( type ) ;
      }
  } ;
    }
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

        mm.enter( mom.registrationDebug(), "handleArrayType",
      type.name() ) ;

        TypeConverter result = null ;
        try {
            final EvaluatedType ctype = type.componentType() ;
            final TypeConverter ctypeTc = mom.getTypeConverter( ctype ) ;
            final OpenType cotype = ctypeTc.getManagedType() ;
            final OpenType ot = getArrayType( cotype ) ;

            mm.info( mom.registrationDebug(), "ctype=", ctype,
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

                (EvaluatedClassDeclaration)getReturnType( type, "iterator") ;
            if (type2 == null) {
                throw Exceptions.self.iteratorNotFound(type) ;
            }

            EvaluatedType tcType = getReturnType( type2, "next" ) ;
            if (tcType == null) {
                throw Exceptions.self.nextNotFound(type) ;
            }

            TypeConverter tc = mom.getTypeConverter( tcType ) ;

            result = new TypeConverterListBase( type, tc ) {
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return ((Iterable)obj).iterator() ;
                    }
                }
            } ;
        } else if (Collection.class.isAssignableFrom(type.cls())) {
            EvaluatedClassDeclaration type2 =
                (EvaluatedClassDeclaration)getReturnType( type, "iterator") ;
            EvaluatedType tcType = getReturnType( type2, "next" ) ;
            TypeConverter tc = mom.getTypeConverter( tcType ) ;

            result = new TypeConverterListBase( type, tc ) {
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return ((Iterable)obj).iterator() ;
                    }
                }
            } ;
        } else if (Iterator.class.isAssignableFrom(type.cls())) {
            EvaluatedType tcType = getReturnType( type, "next" ) ;
            TypeConverter tc = mom.getTypeConverter( tcType ) ;

            result = new TypeConverterListBase( type, tc ) {
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return (Iterator)obj ;
                    }
                }
            } ;
        } else if (Enumeration.class.isAssignableFrom(type.cls())) {
            EvaluatedType tcType = getReturnType( type, "next" ) ;

            TypeConverter tc = mom.getTypeConverter( tcType ) ;
            result = new TypeConverterListBase( type, tc ) {
                @SuppressWarnings("unchecked")
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return new EnumerationAdapter( (Enumeration)obj ) ;
                    }
                }
            } ;
        } else if (Map.class.isAssignableFrom(type.cls())) {
            EvaluatedType type1 = getParameterType( type, "put", 0 ) ;
            TypeConverter firstTc = mom.getTypeConverter( type1 ) ;
            EvaluatedType type2 = getReturnType( type, "put" ) ;
            TypeConverter secondTc = mom.getTypeConverter( type2 ) ;

            result = new TypeConverterMapBase( type, firstTc, secondTc ) {
                @SuppressWarnings("unchecked")
                protected Table getTable( Object obj ) {
                    if (obj == null) {
                        return emptyTable() ;
                    } else {
                        return new TableMapImpl( (Map)obj ) ;
                    }
                }
            } ;
        } else if (Dictionary.class.isAssignableFrom(type.cls())) {
            EvaluatedType type1 = getParameterType( type, "put", 0 ) ;
            TypeConverter firstTc = mom.getTypeConverter( type1 ) ;
            EvaluatedType type2 = getReturnType( type, "put" ) ;
            TypeConverter secondTc = mom.getTypeConverter( type2 ) ;

            result = new TypeConverterMapBase( type, firstTc, secondTc ) {
                @SuppressWarnings("unchecked")
                protected Table getTable( Object obj ) {
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

        if (type instanceof EvaluatedClassDeclaration) {
      return ((EvaluatedClassDeclaration)type).cls() ;
  } else if (type instanceof EvaluatedArrayType) {
      // Same trick as above.
      final EvaluatedArrayType gat = (EvaluatedArrayType)type ;
      final EvaluatedType ctype = canonicalType( gat.componentType() ) ;
      final Class cclass = getJavaClass( ctype ) ;
      final Object temp = Array.newInstance( cclass, 0 ) ;
      return temp.getClass() ;
  } else {
            throw Exceptions.self.cannotConvertToJavaType(type) ;
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

    }

    private static TypeConverter handleSimpleType( final EvaluatedType type,
  final OpenType stype ) {

        final EvaluatedType canType = canonicalType( type ) ;

  return new TypeConverterImpl( type, stype ) {
      public Object toManagedEntity( final Object obj ) {
    return obj ;
      }

            @Override
      public Object fromManagedEntity( final Object entity ) {
    return entity ;
      }

            @Override
      public boolean isIdentity() {
    return canType.equals( type ) ;
      }
  } ;
    }
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

        mm.enter( mom.registrationDebug(), "handleArrayType",
      type.name() ) ;

        TypeConverter result = null ;
        try {
            final EvaluatedType ctype = type.componentType() ;
            final TypeConverter ctypeTc = mom.getTypeConverter( ctype ) ;
            final OpenType cotype = ctypeTc.getManagedType() ;
            final OpenType ot = getArrayType( cotype ) ;

            mm.info( mom.registrationDebug(), "ctype=", ctype,
View Full Code Here

Examples of org.glassfish.gmbal.typelib.EvaluatedType

                (EvaluatedClassDeclaration)getReturnType( type, "iterator") ;
            if (type2 == null) {
                throw Exceptions.self.iteratorNotFound(type) ;
            }

            EvaluatedType tcType = getReturnType( type2, "next" ) ;
            if (tcType == null) {
                throw Exceptions.self.nextNotFound(type) ;
            }

            TypeConverter tc = mom.getTypeConverter( tcType ) ;

            result = new TypeConverterListBase( type, tc ) {
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return ((Iterable)obj).iterator() ;
                    }
                }
            } ;
        } else if (Collection.class.isAssignableFrom(type.cls())) {
            EvaluatedClassDeclaration type2 =
                (EvaluatedClassDeclaration)getReturnType( type, "iterator") ;
            EvaluatedType tcType = getReturnType( type2, "next" ) ;
            TypeConverter tc = mom.getTypeConverter( tcType ) ;

            result = new TypeConverterListBase( type, tc ) {
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return ((Iterable)obj).iterator() ;
                    }
                }
            } ;
        } else if (Iterator.class.isAssignableFrom(type.cls())) {
            EvaluatedType tcType = getReturnType( type, "next" ) ;
            TypeConverter tc = mom.getTypeConverter( tcType ) ;

            result = new TypeConverterListBase( type, tc ) {
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return (Iterator)obj ;
                    }
                }
            } ;
        } else if (Enumeration.class.isAssignableFrom(type.cls())) {
            EvaluatedType tcType = getReturnType( type, "next" ) ;

            TypeConverter tc = mom.getTypeConverter( tcType ) ;
            result = new TypeConverterListBase( type, tc ) {
                @SuppressWarnings("unchecked")
                protected Iterator getIterator( Object obj ) {
                    if (obj == null) {
                        return emptyIterator() ;
                    } else {
                        return new EnumerationAdapter( (Enumeration)obj ) ;
                    }
                }
            } ;
        } else if (Map.class.isAssignableFrom(type.cls())) {
            EvaluatedType type1 = getParameterType( type, "put", 0 ) ;
            TypeConverter firstTc = mom.getTypeConverter( type1 ) ;
            EvaluatedType type2 = getReturnType( type, "put" ) ;
            TypeConverter secondTc = mom.getTypeConverter( type2 ) ;

            result = new TypeConverterMapBase( type, firstTc, secondTc ) {
                @SuppressWarnings("unchecked")
                protected Table getTable( Object obj ) {
                    if (obj == null) {
                        return emptyTable() ;
                    } else {
                        return new TableMapImpl( (Map)obj ) ;
                    }
                }
            } ;
        } else if (Dictionary.class.isAssignableFrom(type.cls())) {
            EvaluatedType type1 = getParameterType( type, "put", 0 ) ;
            TypeConverter firstTc = mom.getTypeConverter( type1 ) ;
            EvaluatedType type2 = getReturnType( type, "put" ) ;
            TypeConverter secondTc = mom.getTypeConverter( type2 ) ;

            result = new TypeConverterMapBase( type, firstTc, secondTc ) {
                @SuppressWarnings("unchecked")
                protected Table getTable( Object obj ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.