Package javax.annotation

Examples of javax.annotation.PostConstruct


        // @PostConstruct
        Method postConstructMethod = null;
        for (final Method method : methods) {

            final PostConstruct postConstructAnnotation = method.getAnnotation(PostConstruct.class);
            if (postConstructAnnotation == null) {
                continue;
            }
            if (postConstructMethod != null) {
                throw new RuntimeException("Found more than one @PostConstruct method; service is: " + serviceClass.getName() + ", found " + postConstructMethod.getName() + " and " + method.getName());
View Full Code Here


      super(finder);
   }

   public void process(RemoteEnvironmentRefsGroupMetaData metaData, Method element)
   {
      PostConstruct annotation = finder.getAnnotation(element, PostConstruct.class);
      if(annotation == null)
         return;

      LifecycleCallbackMetaData callback = super.create(element);
      LifecycleCallbacksMetaData postConstructs = metaData.getPostConstructs();
View Full Code Here

   public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, M metaData, ClassLoader classLoader, String methodName, String... parameterNames)
   {
      if(log.isTraceEnabled()) log.trace("retrieve annotation " + annotationClass + " on " + metaData + " for " + methodName + " " + Arrays.toString(parameterNames));
      if(annotationClass == PostConstruct.class)
      {
         PostConstruct lifeCycleAnnotation = getLifeCycleAnnotation(metaData.getPostConstructs(), PostConstructImpl.class, methodName);
         if(lifeCycleAnnotation != null)
            return annotationClass.cast(lifeCycleAnnotation);
      }
      else if(annotationClass == PreDestroy.class)
      {
View Full Code Here

    public void invokePostConstruct() {
       
        boolean accessible = false;
        for (Method method : getPostConstructMethods()) {
            PostConstruct pc = method.getAnnotation(PostConstruct.class);
            if (pc != null) {
                try {
                    method.setAccessible(true);
                    method.invoke(target);
                } catch (IllegalAccessException e) {
View Full Code Here

    public void invokePostConstruct() {
       
        boolean accessible = false;
        for (Method method : getPostConstructMethods()) {
            PostConstruct pc = method.getAnnotation(PostConstruct.class);
            if (pc != null) {
                try {
                    method.setAccessible(true);
                    method.invoke(target);
                } catch (IllegalAccessException e) {
View Full Code Here

    }

    public void invokePostConstruct(Object instance) {
        for (Method method : getMethods(instance.getClass(),
                PostConstruct.class)) {
            PostConstruct pc = method.getAnnotation(PostConstruct.class);
            if (pc != null) {
                boolean accessible = method.isAccessible();
                try {
                    method.setAccessible(true);
                    method.invoke(instance);
View Full Code Here

    }

    private void postConstruct(Object resource) throws IllegalAccessException, InvocationTargetException {
        Method[] methods = resource.getClass().getMethods();
        for (Method method : methods) {
            PostConstruct postConstructAnnotation = method.getAnnotation(PostConstruct.class);
            if (postConstructAnnotation != null) {
                Object[] args = {};
                method.invoke(resource, args);

            }
View Full Code Here

      if(cls == null)
         return;
     
      for(Method method : cls.getDeclaredMethods())
      {
         PostConstruct postConstruct = method.getAnnotation(PostConstruct.class);
         if(postConstruct != null)
         {
            // TODO: sure?
            // http://java.sun.com/javase/6/docs/api/javax/annotation/PostConstruct.html
            if(postConstructs.size() > 0)
View Full Code Here

         return null;
      }

      Method resolvePostConstruct(Method method)
      {
         PostConstruct ann = (PostConstruct) getAnnotation(method, PostConstruct.class);
         return resolveLifecycleMethod(method, ann);
      }
View Full Code Here

    public void invokePostConstruct() {
       
        boolean accessible = false;
        for (Method method : getPostConstructMethods()) {
            PostConstruct pc = method.getAnnotation(PostConstruct.class);
            if (pc != null) {
                try {
                    ReflectionUtil.setAccessible(method);
                    method.invoke(target);
                } catch (IllegalAccessException e) {
View Full Code Here

TOP

Related Classes of javax.annotation.PostConstruct

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.