Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.ParameterInfo


      TypeInfoFactory factory = getTypeInfoFactory();

      ClassInfo simpleInterface = (ClassInfo) factory.getTypeInfo(SimpleInterface.class);
     
      TypeInfo boolType = PrimitiveInfo.BOOLEAN;
      ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType);
      ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam };

      TypeInfo booleanType = factory.getTypeInfo(Boolean.class);

      TypeInfo intType = PrimitiveInfo.INT;
      ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType);
      ParameterInfo[] intParameters = new ParameterInfo[] { intParam };

      TypeInfo objectType = factory.getTypeInfo(Object.class);
      ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType);
      ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam };

      TypeInfo stringType = factory.getTypeInfo(String.class);
      ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType);
      ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam };

      TypeInfo urlType = factory.getTypeInfo(URL.class);
      ParameterInfo urlParam = new ParameterInfoImpl(null, "arg1", urlType);
      ParameterInfo[] twoParameters = new ParameterInfo[] { stringParam, urlParam };

      TypeInfo voidType = PrimitiveInfo.VOID;
     
      HashSet<MethodInfo> result = new HashSet<MethodInfo>();
View Full Code Here


      TypeInfoFactory factory = getTypeInfoFactory();

      ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class);
     
      TypeInfo boolType = PrimitiveInfo.BOOLEAN;
      ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType);
      ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam };

      TypeInfo booleanType = factory.getTypeInfo(Boolean.class);

      TypeInfo intType = PrimitiveInfo.INT;
      ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType);
      ParameterInfo[] intParameters = new ParameterInfo[] { intParam };

      TypeInfo objectType = factory.getTypeInfo(Object.class);
      ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType);
      ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam };

      TypeInfo stringType = factory.getTypeInfo(String.class);
      ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType);
      ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam };

      TypeInfo urlType = factory.getTypeInfo(URL.class);
      ParameterInfo urlParam = new ParameterInfoImpl(null, "arg1", urlType);
      ParameterInfo[] twoParameters = new ParameterInfo[] { stringParam, urlParam };

      TypeInfo voidType = PrimitiveInfo.VOID;
     
      HashSet<MethodInfo> result = new HashSet<MethodInfo>();
View Full Code Here

      TypeInfoFactory factory = getTypeInfoFactory();

      ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class);

      TypeInfo stringType = factory.getTypeInfo(String.class);
      ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType);
      ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam };
     
      TypeInfo boolType = PrimitiveInfo.BOOLEAN;
      ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType);
      ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam };

      TypeInfo intType = PrimitiveInfo.INT;
      ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType);
      ParameterInfo[] intParameters = new ParameterInfo[] { intParam };

      TypeInfo objectType = factory.getTypeInfo(Object.class);
      ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType);
      ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam };

      HashSet<ConstructorInfo> result = new HashSet<ConstructorInfo>();
      result.add(new ConstructorInfoImpl(null, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean));
      result.add(new ConstructorInfoImpl(null, stringParameters, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, simpleBean));
View Full Code Here

   private void checkParameterAnnotations(ParameterInfo[] params)
   {
      assertEquals(2, params.length);
     
      ParameterInfo param = getCheckParameter(params, 0, "int");
      AnnotationValue[] annotations = param.getAnnotations();
      checkExpectedAnnotations(annotations, FIRST_PARAM_EXPECTED_ANNOTATIONS);
      checkValueAnnotation(annotations[0], "int");
      checkComplexAnnotation(annotations[1], PARAM_DATA);
     
      param = getCheckParameter(params, 1, "java.lang.String");
      annotations = param.getAnnotations();
      checkExpectedAnnotations(annotations, SECOND_PARAM_EXPECTED_ANNOTATIONS);
      checkValueAnnotation(annotations[0], "string");
      AnnotationInfo type = annotations[1].getAnnotationType();
      assertEquals(SimpleAnnotation.class.getName(), type.getName());
   }
View Full Code Here

      assertEquals(SimpleAnnotation.class.getName(), type.getName());
   }
  
   private ParameterInfo getCheckParameter(ParameterInfo[] params, int index, String typeName)
   {
      ParameterInfo param = params[index];
      TypeInfo info = param.getParameterType();
      assertEquals(typeName, info.getName());
     
      return param;
   }
View Full Code Here

      // Process the op parameters
      if( paramInfo != null )
      {
         for(int i = 0; i < paramInfo.length; i ++)
         {
            ParameterInfo pinfo = paramInfo[i];
            String pname = pinfo.getName();
            String pdescription = null;
            ManagementParameter mpa = null;
            // Look to ManagementParameter for info
            if (i < params.length)
            {
               mpa = params[i];
               if (mpa.name().equals(AnnotationDefaults.EMPTY_STRING) == false)
                  pname = mpa.name();
               if (mpa.description().equals(AnnotationDefaults.EMPTY_STRING) == false)
                  pdescription = mpa.description();
            }
            // Generate a name if there is none
            if (pname == null)
               pname = "arg#" + i;
            Fields fields =  new DefaultFieldsImpl(pname);
            if (pdescription != null)
               fields.setField(Fields.DESCRIPTION, pdescription);
            MetaMapper[] paramMapper = {null};
            MetaType metaType = getMetaType(pinfo, pinfo.getParameterType(), metaData, true, paramMapper);
            fields.setField(Fields.META_TYPE, metaType);
            // Delegate others (legal values, min/max etc.) to the constraints factory
            try
            {
               Class<? extends ManagedParameterConstraintsPopulatorFactory> factoryClass = opConstraintsFactor;
View Full Code Here

         typeInfos[i] = parameters[i].getParameterType();

      List<ParameterMetaData> pmds = new ArrayList<ParameterMetaData>();
      for(int i=0; i < parameters.length; i++)
      {
         ParameterInfo pi = parameters[i];
         Signature pis = createParametersSignature(
               pi.getName(),
               Configurator.getParameterTypes(log.isTraceEnabled(), typeInfos),
               i
         );
         MetaData mdr = retrieval.getComponentMetaData(pis);
         if (mdr != null)
         {
            ValueMetaData value = null;
            for (Annotation ann : mdr.getAnnotations())
            {
               Annotation2ValueMetaDataAdapter adapter = adapters.get(ann.annotationType());
               if (adapter != null)
               {
                  value = adapter.createValueMetaData(pi, ann, value);
               }
            }

            if (value == null)
               throw new IllegalArgumentException("No such Annotation2ValueMetaData adapter or no annotation on ParameterInfo: " + pi);
            if (trace)
               log.trace("Adding new ParameterMetaData for annotation: " + value);
            pmds.add(new AbstractParameterMetaData(pi.getParameterType().getName(), value));
         }
         else
         {
            throw new IllegalArgumentException("MetaData for parameter must exist: " + pi);
         }
View Full Code Here

      if (this == obj)
         return true;
      if (obj == null || obj instanceof ParameterInfo == false)
         return false;
     
      ParameterInfo other = (ParameterInfo) obj;
      return parameterType.equals(other.getParameterType());
   }
View Full Code Here

         typeInfos[i] = parameters[i].getParameterType();

      List<ParameterMetaData> pmds = new ArrayList<ParameterMetaData>();
      for(int i=0; i < parameters.length; i++)
      {
         ParameterInfo pi = parameters[i];
         Signature pis = new MethodParametersSignature(
               pi.getName(),
               Configurator.getParameterTypes(log.isTraceEnabled(), typeInfos),
               i
         );
         MetaData mdr = retrieval.getComponentMetaData(pis);
         if (mdr != null)
         {
            ValueMetaData value = null;
            for(Annotation2ValueMetaDataAdapter adapter : adapters)
            {
               // todo - match multiple annotations?
               Annotation adapterAnnotation = mdr.getAnnotation(adapter.getAnnotation());
               if (adapterAnnotation != null)
               {
                  value = adapter.createValueMetaData(adapterAnnotation);
                  break;
               }
            }
            if (value == null)
               throw new IllegalArgumentException("No such Annotation2ValueMetaData adapter or no annotation on ParameterInfo: " + pi);
            if (trace)
               log.trace("Adding new ParameterMetaData for annotation: " + value);
            pmds.add(new AbstractParameterMetaData(pi.getParameterType().getName(), value));
         }
         else
         {
            throw new IllegalArgumentException("MetaData for parameter must exist: " + pi);
         }
View Full Code Here

      if( paramInfo != null )
      {
         for(int i = 0; i < paramInfo.length; i ++)
         {
            ParameterInfo pinfo = paramInfo[i];
            String pname = pinfo.getName();
            String pdescription = null;
            ManagementParameter mpa = null;
            // Look to ManagementParameter for info
            if (i < params.length)
            {
               mpa = params[i];
               if (mpa.name().equals(AnnotationDefaults.EMPTY_STRING) == false)
                  pname = mpa.name();
               if (mpa.description().equals(AnnotationDefaults.EMPTY_STRING) == false)
                  pdescription = mpa.description();
            }
            // Generate a name if there is none
            if (pname == null)
               pname = "arg#" + i;
            Fields fields =  new DefaultFieldsImpl(pname);
            if (pdescription != null)
               fields.setField(Fields.DESCRIPTION, pdescription);
            MetaType metaType = metaTypeFactory.resolve(pinfo.getParameterType());
            fields.setField(Fields.META_TYPE, metaType);
            // Delegate others (legal values, min/max etc.) to the constraints factory
            try
            {
               Class<? extends ManagedParameterConstraintsPopulatorFactory> factoryClass = opConstraintsFactor;
View Full Code Here

TOP

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

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.