Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.TypeInfo


   @SuppressWarnings("unchecked")
   public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
   {
      Map result = getTypeInstance(info, cl, getExpectedClass());

      TypeInfo keyTypeInfo = getKeyClassInfo(cl);
      TypeInfo valueTypeInfo = getValueClassInfo(cl);

      if (map.size() > 0)
      {
         boolean first = true;
         for (Iterator i = map.entrySet().iterator(); i.hasNext();)
View Full Code Here


      // TODO - perhaps match which related metadata is the right one
      RelatedClassMetaData beanClassMetaData = related.iterator().next();
      KernelConfigurator configurator = context.getKernel().getConfigurator();
      BeanInfo beanInfo = configurator.getBeanInfo(beanClassMetaData.getClassName(), context.getClassLoader());
      PropertyInfo pi = beanInfo.getProperty(valueInfo.name);
      TypeInfo typeInfo = pi.getType();
      if (typeInfo.isCollection() || typeInfo.isMap())
      {
         throw new IllegalArgumentException("Cannot handle collection or map: " + valueInfo);
      }
      return typeInfo;
   }
View Full Code Here

         Cardinality cardinality)
   {
      if (info instanceof ClassInfo)
      {
         ClassInfo ci = (ClassInfo)info;
         TypeInfo componentType = ci.getComponentType();
         if (componentType == null)
            throw new IllegalArgumentException("Null component type: " + info);
         Class<?> clazz = componentType.getType();
         if (Object.class.equals(clazz))
            throw new IllegalArgumentException("Component type too general - equals Object: " + info);
         Class<? extends Collection<Object>> collectionType = (Class) info.getType();
         CollectionCallbackItemFactory factory = getCollectionFactory();
         return factory.createCollectionCallbackItem(collectionType, clazz, whenRequired, dependentState, cardinality, context, attribute);
View Full Code Here

         Cardinality cardinality)
   {
      if (ai.isValid() == false)
         throw new IllegalArgumentException("Not a valid attribute info: " + ai);

      TypeInfo info = ai.getType();
      if (info.isCollection())
         return createCollectionCallback(info, context, ai, whenRequired, dependentState, cardinality);
      else if (ai.isProperty())
         return new ClassAttributeCallbackItem(info.getType(), whenRequired, dependentState, cardinality, context, ai.getName());
      else
         return new ClassSingleCallbackItem(info.getType(), whenRequired, dependentState, cardinality, context, ai.getName(), info.getName());
   }
View Full Code Here

      {
         CtClass ctClass = getCtClass(clazz.getName());

         if (clazz.isArray())
         {
            TypeInfo componentType = getTypeInfo(clazz.getComponentType());
            return new JavassistArrayInfoImpl(this, ctClass, clazz, componentType);
         }

         if (ctClass.isAnnotation())
         {
View Full Code Here

   public TypeInfo getTypeInfo(Class<?> clazz)
   {
      if (clazz == null)
         throw new IllegalArgumentException("Null class");

      TypeInfo primitive = PrimitiveInfo.valueOf(clazz.getName());
      if (primitive != null)
         return primitive;

      NumberInfo number = NumberInfo.valueOf(clazz.getName());
      if (number != null)
View Full Code Here

      if (name == null)
         throw new IllegalArgumentException("Null class name");
      if (cl == null)
         cl = Thread.currentThread().getContextClassLoader();

      TypeInfo primitive = PrimitiveInfo.valueOf(name);
      if (primitive != null)
         return primitive;

      NumberInfo number = NumberInfo.valueOf(name);
      if (number != null)
View Full Code Here

   private static String getName(TypeInfo componentType)
   {
      StringBuilder builder = new StringBuilder();
      builder.append("[");
      TypeInfo temp = componentType;
      while (temp.isArray())
      {
         builder.append("[");
         temp = ((JavassistArrayInfoImpl) temp).componentType;
      }
      if (temp.isPrimitive())
      {
         // Use the signature encoded name for the primitive element type
         String encodedName = PrimitiveInfo.getPrimativeArrayType(temp.getName());
         builder.append(encodedName);
      }
      else
      {
         builder.append("L").append(temp.getName()).append(";");
      }
      return builder.toString();
   }
View Full Code Here

   {
      if (value != null)
      {
         for (PropertyInfo pi : propertys)
         {
            TypeInfo info = pi.getType();
            if (info != null)
            {
               TypeInfo valueTypeInfo = info.getTypeInfoFactory().getTypeInfo(value.getClass());
               if (info.isAssignableFrom(valueTypeInfo))
               {
                  pi.set(bean, value);
                  return;
               }
View Full Code Here

   protected Map<ClassLoader, Map<String, Map<BeanAccessMode, BeanInfo>>> cache = new WeakHashMap<ClassLoader, Map<String, Map<BeanAccessMode, BeanInfo>>>();
  
   protected static boolean isGetter(MethodInfo minfo)
   {
      String name = minfo.getName();
      TypeInfo returnType = minfo.getReturnType();
      TypeInfo[] parameters = minfo.getParameterTypes();
      if ((name.length() > 3 && name.startsWith("get")) || (name.length() > 2 && name.startsWith("is")))
      {
         // isBoolean() is not a getter for java.lang.Boolean
         if (name.startsWith("is") && PrimitiveInfo.BOOLEAN.equals(returnType) == false)
View Full Code Here

TOP

Related Classes of org.jboss.reflect.spi.TypeInfo

Copyright © 2018 www.massapicom. 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.