Package java.lang.reflect

Examples of java.lang.reflect.AnnotatedElement


  private static final Log LOG = LoggerFactory.make();

  @Override
  public FieldBridge provideFieldBridge(ExtendedBridgeProviderContext context) {
    FieldBridge bridge = null;
    AnnotatedElement annotatedElement = context.getAnnotatedElement();
    if ( annotatedElement.isAnnotationPresent( Spatial.class ) ) {
      Spatial spatialAnn = annotatedElement.getAnnotation( Spatial.class );
      try {
        bridge = buildSpatialBridge( spatialAnn, null, null );
      }
      catch (Exception e) {
        throw LOG.unableToInstantiateSpatial( context.getMemberName(), e );
View Full Code Here


  private static final FieldBridge CALENDAR_SECOND = new TwoWayString2FieldBridgeAdaptor( CalendarBridge.CALENDAR_SECOND );
  public static final FieldBridge CALENDAR_MILLISECOND = new TwoWayString2FieldBridgeAdaptor( CalendarBridge.CALENDAR_MILLISECOND );

  @Override
  public FieldBridge provideFieldBridge(ExtendedBridgeProviderContext context) {
    AnnotatedElement annotatedElement = context.getAnnotatedElement();
    if ( annotatedElement.isAnnotationPresent( org.hibernate.search.annotations.CalendarBridge.class ) ) {
      Resolution resolution = annotatedElement.getAnnotation( org.hibernate.search.annotations.CalendarBridge.class )
          .resolution();
      return getCalendarField( resolution );
    }
    return null;
  }
View Full Code Here

  private static final FieldBridge DATE_SECOND = new TwoWayString2FieldBridgeAdaptor( DateBridge.DATE_SECOND );
  public static final FieldBridge DATE_MILLISECOND = new TwoWayString2FieldBridgeAdaptor(DateBridge.DATE_MILLISECOND );

  @Override
  public FieldBridge provideFieldBridge(ExtendedBridgeProviderContext context) {
    AnnotatedElement annotatedElement = context.getAnnotatedElement();
    if ( annotatedElement.isAnnotationPresent( org.hibernate.search.annotations.DateBridge.class ) ) {
      Resolution resolution = annotatedElement.getAnnotation( org.hibernate.search.annotations.DateBridge.class )
          .resolution();
      return getDateField( resolution );
    }
    return null;
  }
View Full Code Here

      this.aoClass = aoClass;
   }

   public M getAnnotatedElement()
   {
      AnnotatedElement result = null;

      Class<?> clazz = getOwner();
      if (signature instanceof ConstructorSignature || signature instanceof ConstructorParametersSignature)
      {
         try
View Full Code Here

    *
    * @return the read annotation
    */
   protected A readAnnotation()
   {
      AnnotatedElement annotatedElement = getAnnotatedElement();
      return annotatedElement.getAnnotation(annClass);
   }
View Full Code Here

   }

   @SuppressWarnings("unchecked")
   public M getAnnotatedElement()
   {
      AnnotatedElement em = getOwner();
      return (M)em;
   }
View Full Code Here

        return new Version(1, 7, 0, "abc", "org.apache.cloudstack", "cloudstack-framework-rest");
    }

    @Override
    public Object findSerializer(Annotated a) {
        AnnotatedElement ae = a.getAnnotated();
        Url an = ae.getAnnotation(Url.class);
        if (an == null) {
            return null;
        }

        if (an.type() == String.class) {
View Full Code Here

    private Properties properties;

    public PersistenceElement(Member member, PropertyDescriptor pd) {
      super(member, pd);
      AnnotatedElement ae = (AnnotatedElement) member;
      PersistenceContext pc = ae.getAnnotation(PersistenceContext.class);
      PersistenceUnit pu = ae.getAnnotation(PersistenceUnit.class);
      Class resourceType = EntityManager.class;
      if (pc != null) {
        if (pu != null) {
          throw new IllegalStateException("Member may only be annotated with either " +
              "@PersistenceContext or @PersistenceUnit, not both: " + member);
View Full Code Here

            else
                members = cls.getDeclaredMethods();

            for (int i = 0; i < members.length; i++) {
                Member member = members[i];
                AnnotatedElement el = (AnnotatedElement) member;
                XMLMetaData field = null;
                if (el.getAnnotation(xmlElementClass) != null) {
                    String xmlname = (String) xmlElementName.invoke(el
                        .getAnnotation(xmlElementClass), new Object[]{});
                    // avoid JAXB XML bind default name
                    if (StringUtils.equals(XMLMetaData.defaultName, xmlname))
                        xmlname = member.getName();
                    if ((AccessController.doPrivileged(J2DoPrivHelper
                        .isAnnotationPresentAction(((Field) member).getType(),
                            xmlTypeClass))).booleanValue()) {
                        field = _repos.addXMLClassMetaData(((Field) member).getType());
                        parseXmlRootElement(((Field) member).getType(), field);
                        populateFromReflection(((Field) member).getType()
                            , field);
                        field.setXmltype(XMLMetaData.XMLTYPE);
                        field.setXmlname(xmlname);
                    }
                    else {
                        field = _repos.newXMLFieldMetaData(((Field) member)
                            .getType(), member.getName());
                        field.setXmltype(XMLMetaData.ELEMENT);
                        field.setXmlname(xmlname);
                        field.setXmlnamespace((String) xmlElementNamespace
                            .invoke(el.getAnnotation(xmlElementClass)
                            , new Object[]{}));                   
                    }
                }
                else if (el.getAnnotation(xmlAttributeClass) != null) {
                    field = _repos.newXMLFieldMetaData(((Field) member)
                        .getType(), member.getName());
                    field.setXmltype(XMLFieldMetaData.ATTRIBUTE);
                    String xmlname = (String) xmlAttributeName.invoke(
                        el.getAnnotation(xmlAttributeClass), new Object[]{});
                    // avoid JAXB XML bind default name
                    if (StringUtils.equals(XMLMetaData.defaultName, xmlname))
                        xmlname = member.getName();
                    field.setXmlname("@"+xmlname);
                    field.setXmlnamespace((String) xmlAttributeNamespace.invoke(
                        el.getAnnotation(xmlAttributeClass), new Object[]{}));
                }
                if (field != null)
                    meta.addField(member.getName(), field);
            }
        } catch(Exception e) {
View Full Code Here

        String message = new String("Error in decorator : "+ toString() + ". The delegate injection point must be an injected field, " +
                "initializer method parameter or bean constructor method parameter. ");
       
        if(!(ipFound.getMember() instanceof Constructor))
        {
            AnnotatedElement element = (AnnotatedElement)ipFound.getMember();
            if(!element.isAnnotationPresent(Inject.class))
            {
                throw new WebBeansConfigurationException(message);
            }               
        }
       
View Full Code Here

TOP

Related Classes of java.lang.reflect.AnnotatedElement

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.