Examples of FieldHandle


Examples of com.firefly.utils.json.support.FieldHandle

              && Modifier.isTransient(field.getModifiers())) {
            continue;
          }

          try {
            FieldHandle fieldSerializer = new FieldHandle();
            fieldSerializer.setPropertyName(propertyName);
            fieldSerializer.setMethod(method);
            fieldList.add(fieldSerializer);

            appendPair(propertyName, method.invoke(obj));
            sb.append(SEPARATOR);
          } catch (IllegalArgumentException e) {
            e.printStackTrace();
          } catch (IllegalAccessException e) {
            e.printStackTrace();
          } catch (InvocationTargetException e) {
            e.printStackTrace();
          }
        } else if (methodName.startsWith("is")) { // 取is方法的返回值
          if (methodName.length() < 3
              || !Character.isUpperCase(methodName.charAt(2))) {
            continue;
          }

          String propertyName = Character.toLowerCase(methodName
              .charAt(2))
              + methodName.substring(3);

          Field field = null;
          try {
            field = clazz.getDeclaredField(propertyName);
          } catch (SecurityException e) {
            e.printStackTrace();
          } catch (NoSuchFieldException e) {
            e.printStackTrace();
          }
          if (field != null
              && Modifier.isTransient(field.getModifiers())) {
            continue;
          }

          try {
            FieldHandle fieldSerializer = new FieldHandle();
            fieldSerializer.setPropertyName(propertyName);
            fieldSerializer.setMethod(method);
            fieldList.add(fieldSerializer);

            appendPair(propertyName, method.invoke(obj));
            sb.append(SEPARATOR);
          } catch (IllegalArgumentException e) {
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

    }

    private void transformMethod(final PlasticClass plasticClass, final PlasticMethod method) {

        final PlasticField tokenFieldInstance = plasticClass.introduceField(InterceptorStatusToken.class,"_$token");
        final FieldHandle tokenFieldHandle = tokenFieldInstance.getHandle();
       
       
        // Attribute definition
        final Secured annotation = method.getAnnotation(Secured.class);
        //final String configField = createConfigAttributeDefinitionField(transformation, annotation);
        final ConfigAttributeHolder confAttrHolder = createConfigAttributeDefinitionField(plasticClass, annotation);

        final SecurityChecker secChecker = this.securityChecker;
        MethodAdvice securedMethodAdvice = new MethodAdvice() {
         
          public void advise(MethodInvocation invocation) {
           
              InterceptorStatusToken statusTokenVal = secChecker.checkBefore(confAttrHolder);
              tokenFieldHandle.set(invocation.getInstance(), statusTokenVal);
               
                invocation.proceed();

                InterceptorStatusToken tokenFieldValue = (InterceptorStatusToken) tokenFieldHandle.get(invocation.getInstance());
                secChecker.checkAfter(tokenFieldValue, null);
            }
        };

        method.addAdvice(securedMethodAdvice);
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

        Class fieldType = classCache.forName(field.getTypeName());

        ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType);

        FieldHandle handle = field.getHandle();

        String fieldName = String.format("%s.%s", field.getPlasticClass().getClassName(), field.getName());

        setValueFromInitializeEventHandler(support, fieldName, handle, parameterName, encoder, urlEncoder);
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

    private void transformField(TransformationSupport support, PlasticField field)
    {
        PageActivationContext annotation = field.getAnnotation(PageActivationContext.class);

        FieldHandle handle = field.getHandle();

        if (annotation.activate())
        {
            support.addEventHandler(EventConstants.ACTIVATE, 1,
                    "PageActivationContextWorker activate event handler",
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

            {
                int count = Math.min(handles.length, event.getEventContext().getCount());
                for (int i = 0; i < count; ++i)
                {
                    String fieldType = fieldTypes[i];
                    FieldHandle handle = handles[i];
                    Object value = event.coerceContext(i, fieldType);
                    handle.set(instance, value);
                }
            }
        };
    }
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

                } else {
                    LinkedList<Object> list = CollectionFactory.newLinkedList();

                    // iterate backwards
                    for (int i = handles.length - 1; i > -1; i--) {
                        FieldHandle handle = handles[i];
                        Object value = handle.get(instance);

                        // ignore trailing nulls
                        if (value != null || !list.isEmpty()) {
                            list.addFirst(value);
                        }
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

        Class fieldType = classCache.forName(field.getTypeName());

        ValueEncoder encoder = valueEncoderSource.getValueEncoder(fieldType);

        FieldHandle handle = field.getHandle();

        String fieldName = String.format("%s.%s", field.getPlasticClass().getClassName(), field.getName());

        setValueFromInitializeEventHandler(support, fieldName, annotation.required(), handle, parameterName, encoder, urlEncoder);
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

        public void replaceAccess(TransformField conduitField)
        {
            // Ugly:
            PlasticField conduitFieldPlastic = ((BridgeTransformField) conduitField).plasticField;

            final FieldHandle conduitHandle = conduitFieldPlastic.getHandle();

            plasticField.setConduit(new WrapFieldHandleForFieldValueConduitAsFieldConduit(conduitHandle));
        }
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

            plasticField.injectComputed(toComputedValue(provider));
        }

        public FieldAccess getAccess()
        {
            final FieldHandle handle = plasticField.getHandle();

            return new WrapFieldHandleAsFieldAccess(handle);
        }
View Full Code Here

Examples of org.apache.tapestry5.plastic.FieldHandle

    private void transformField(TransformationSupport support, PlasticField field)
    {
        PageActivationContext annotation = field.getAnnotation(PageActivationContext.class);

        FieldHandle handle = field.getHandle();

        if (annotation.activate())
        {
            support.addEventHandler(EventConstants.ACTIVATE, 1,
                    "PageActivationContextWorker activate event handler",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.