Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.TypeInfo


         ClassLoader cl = getClassLoader(beanMetaData);

         ValueMetaData vmd = metaData.getValue();
         if (vmd != null)
         {
            TypeInfo typeInfo = null;
            if (info != null)
               typeInfo = info.getClassInfo();
            return new ValueJoinpoint(vmd, typeInfo, cl);
         }
View Full Code Here


      else if (trace)
         log.trace("No properties");

      // get Object's class info - it's cached so it shouldn't take much
      TypeInfoFactory tif = classInfo.getTypeInfoFactory();
      TypeInfo objectTI = tif.getTypeInfo(Object.class);

      // method plugins
      Iterable<T> methodPlugins = null;

      // methods
View Full Code Here

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

      TypeInfo elementTypeInfo = getElementClassInfo(cl, info);
      for (int i = 0; i < collection.size(); ++i)
      {
         ValueMetaData vmd = (ValueMetaData) collection.get(i);
         Object value = vmd.getValue(elementTypeInfo, cl);
         try
View Full Code Here

               getDependenciesForAnnotation(topLevelAnnotationName, (AnnotationValue)value, dependencies);
            }
            else if (value instanceof ArrayValue)
            {
               ArrayValue arrVal = (ArrayValue)value;
               TypeInfo type = ((ArrayInfo)arrVal.getType()).getComponentType();
               if (type instanceof AnnotationInfo)
               {
                  Value[] values = arrVal.getValues();
                  for (int j = 0 ; j < values.length ; j++)
                  {
View Full Code Here

   {
      // cannot determine on map, since we don't know if we are key or value
      if (typeInfo instanceof ClassInfo)
      {
         ClassInfo classInfo = (ClassInfo)typeInfo;
         TypeInfo componentType = classInfo.getComponentType();
         if (componentType != null)
            return componentType;
      }
      if (typeInfo.isCollection() || typeInfo.isMap())
      {
View Full Code Here

   @SuppressWarnings("unchecked")
   public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
   {
      Collection result = (Collection)super.getValue(info, cl);

      TypeInfo typeInfo = getClassInfo(cl);
     
      if (typeInfo != null && typeInfo instanceof ClassInfo == false)
         throw new IllegalArgumentException(typeInfo.getName() + " is not a class");

      if (typeInfo == null)
      {
         // No type specified
         if (info == null)
         {
            info = getElementClassInfo(cl, null);
            if (info == null)
               return null;
            info = info.getArrayType();
         }
         // Not a class
         if (info instanceof ClassInfo == false)
            return null;
         // Not an interface
         if (((ClassInfo) info).isInterface())
            return null;
         // Type is too general
         if (Object.class.getName().equals(info.getName()))
            return null;
         // Try to use the passed type
         typeInfo = info;
      }

      Object array = typeInfo.newArrayInstance(result.size());
      int i = 0;
      for(Object element : result)
         Array.set(array, i++, element);
      return array;
   }
View Full Code Here

    */
   protected <T> T getTypeInstance(TypeInfo info, ClassLoader cl, Class<T> expected, boolean preInstantiatedLookup) throws Throwable
   {
      T result = null;

      TypeInfo typeInfo = getClassInfo(cl);
      // we have explicitly set type
      if (typeInfo != null)
         result = createInstance(typeInfo, cl, expected, true);

      if (result == null)
View Full Code Here

   {
      boolean trace = log.isTraceEnabled();
      if (trace)
         log.trace("getValue value=" + getUnderlyingValue() + " type=" + type + " info=" + info);

      TypeInfo typeInfo = getTypeInfo(cl);
      if (typeInfo == null)
         typeInfo = info;
      if (typeInfo == null)
         throw new IllegalArgumentException("Unable to determine type for value: " + getUnderlyingValue());

      // We need to set the context classloader
      // because some property editors use the context classloader
      ClassLoader oldCl = SecurityActions.setContextClassLoader(cl);
      try
      {
         // we convert it with more precise type
         // and then check for progression, ...
         if (typeInfo != info && info != null)
         {
            Object typeValue = typeInfo.convertValue(getUnderlyingValue());
            return info.convertValue(typeValue, replace, trim);
         }
         return typeInfo.convertValue(getUnderlyingValue(), replace, trim);
      }
      finally
      {
         SecurityActions.resetContextClassLoader(oldCl);
      }
View Full Code Here

   public Object execute() throws Throwable
   {
      String name = property.getName();
      PropertyInfo propertyInfo = BeanInfoUtil.getPropertyInfo(beanInfo, target, name);
      TypeInfo propertyTypeInfo = propertyInfo.getType();
      TypeInfo typeInfo = propertyTypeInfo;
      if (typeInfo == null)
         typeInfo = getTypeInfo();

      if (nullify)
      {
         if (typeInfo != null)
         {
            if (typeInfo.isPrimitive() == false)
            {
               try
               {
                  if (propertyTypeInfo != null)
                     beanInfo.setProperty(target, name, null);
View Full Code Here

      for (MethodInfo minfo : methods)
      {
         String miName = minfo.getName();
         if (upperName.equals(miName))
         {
            TypeInfo returnType = minfo.getReturnType();
            TypeInfo[] parameters = minfo.getParameterTypes();
            if (parameters.length == 1 && PrimitiveInfo.VOID.equals(returnType) && typeInfo.equals(parameters[0]))
            {
               minfo.invoke(target, new Object[]{null});
               return;
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.