/** * This will create a synthetic annotation using the provided * interface. All attributes for the provided annotation will * have their default values. * * @param loader this is the class loader to load the annotation * @param label this is the annotation interface to be used * * @return this returns the synthetic annotation to be used */ private Annotation getInstance(ClassLoader loader, Class label) throws Exception { return getInstance(loader, label, false); }
/** * This will create a synthetic annotation using the provided * interface. All attributes for the provided annotation will * have their default values. * * @param loader this is the class loader to load the annotation * @param label this is the annotation interface to be used * * @return this returns the synthetic annotation to be used */ private Annotation getInstance(ClassLoader loader, Class label) throws Exception { return getInstance(loader, label, false); }
/** * This will create a synthetic annotation using the provided * interface. All attributes for the provided annotation will * have their default values. * * @param loader this is the class loader to load the annotation * @param label this is the annotation interface to be used * * @return this returns the synthetic annotation to be used */ private Annotation getInstance(ClassLoader loader, Class label) throws Exception { return getInstance(loader, label, false); }
/** * This is used to create an annotation for the provided type. * Annotations created are used to match the type provided. So * a <code>List</code> will have an <code>ElementList</code> * annotation for example. Matching the annotation to the * type ensures the best serialization for that type. * * @param type the type to create the annotation for * @param dependents these are the dependents for the type * * @return this returns the synthetic annotation to be used */ public Annotation getInstance(Class type, Class[] dependents) throws Exception { ClassLoader loader = getClassLoader(); if(Map.class.isAssignableFrom(type)) { if(isPrimitiveKey(dependents) && isAttribute()) { return getInstance(loader, ElementMap.class, true); } return getInstance(loader, ElementMap.class); } if(Collection.class.isAssignableFrom(type)) { return getInstance(loader, ElementList.class); } return getInstance(type); }
/** * This is used to create an annotation for the provided type. * Annotations created are used to match the type provided. So * a <code>List</code> will have an <code>ElementList</code> * annotation for example. Matching the annotation to the * type ensures the best serialization for that type. * * @param type the type to create the annotation for * @param dependents these are the dependents for the type * * @return this returns the synthetic annotation to be used */ public Annotation getInstance(Class type, Class[] dependents) throws Exception { ClassLoader loader = getClassLoader(); if(Map.class.isAssignableFrom(type)) { if(isPrimitiveKey(dependents) && isAttribute()) { return getInstance(loader, ElementMap.class, true); } return getInstance(loader, ElementMap.class); } if(Collection.class.isAssignableFrom(type)) { return getInstance(loader, ElementList.class); } return getInstance(type); }
/** * This is used to create an annotation for the provided type. * Annotations created are used to match the type provided. So * a <code>List</code> will have an <code>ElementList</code> * annotation for example. Matching the annotation to the * type ensures the best serialization for that type. * * @param type the type to create the annotation for * @param dependents these are the dependents for the type * * @return this returns the synthetic annotation to be used */ public Annotation getInstance(Class type, Class[] dependents) throws Exception { ClassLoader loader = getClassLoader(); if(Map.class.isAssignableFrom(type)) { if(isPrimitiveKey(dependents) && isAttribute()) { return getInstance(loader, ElementMap.class, true); } return getInstance(loader, ElementMap.class); } if(Collection.class.isAssignableFrom(type)) { return getInstance(loader, ElementList.class); } return getInstance(type); }
/** * This is used to create an annotation for the provided type. * Annotations created are used to match the type provided. So * an array of objects will have an <code>ElementArray</code> * annotation for example. Matching the annotation to the * type ensures the best serialization for that type. * * @param type the type to create the annotation for * * @return this returns the synthetic annotation to be used */ private Annotation getInstance(Class type) throws Exception { ClassLoader loader = getClassLoader(); Class entry = type.getComponentType(); if(type.isArray()) { if(isPrimitive(entry)) { return getInstance(loader, Element.class); } return getInstance(loader, ElementArray.class); } if(isPrimitive(type) && isAttribute()) { return getInstance(loader, Attribute.class); } return getInstance(loader, Element.class); }
/** * This is used to create an annotation for the provided type. * Annotations created are used to match the type provided. So * an array of objects will have an <code>ElementArray</code> * annotation for example. Matching the annotation to the * type ensures the best serialization for that type. * * @param type the type to create the annotation for * * @return this returns the synthetic annotation to be used */ private Annotation getInstance(Class type) throws Exception { ClassLoader loader = getClassLoader(); Class entry = type.getComponentType(); if(type.isArray()) { if(isPrimitive(entry)) { return getInstance(loader, Element.class); } return getInstance(loader, ElementArray.class); } if(isPrimitive(type) && isAttribute()) { return getInstance(loader, Attribute.class); } return getInstance(loader, Element.class); }
/** * This is used to create an annotation for the provided type. * Annotations created are used to match the type provided. So * an array of objects will have an <code>ElementArray</code> * annotation for example. Matching the annotation to the * type ensures the best serialization for that type. * * @param type the type to create the annotation for * * @return this returns the synthetic annotation to be used */ private Annotation getInstance(Class type) throws Exception { ClassLoader loader = getClassLoader(); Class entry = type.getComponentType(); if(type.isArray()) { if(isPrimitive(entry)) { return getInstance(loader, Element.class); } return getInstance(loader, ElementArray.class); } if(isPrimitive(type) && isAttribute()) { return getInstance(loader, Attribute.class); } return getInstance(loader, Element.class); }
/** * This method is used to process the field an annotation given. * This will check to determine if the field is accessible, if it * is not accessible then it is made accessible so that private * member fields can be used during the serialization process. * * @param field this is the field to be added as a contact * @param type this is the type to acquire the annotation * @param list this is the list of annotations on the field */ private void process(Field field, Class type, Annotation[] list) throws Exception { Class[] dependents = Reflector.getDependents(field); Annotation label = factory.getInstance(type, dependents); if(label != null) { process(field, label, list); } }
/** * This method is used to process the field an annotation given. * This will check to determine if the field is accessible, if it * is not accessible then it is made accessible so that private * member fields can be used during the serialization process. * * @param field this is the field to be added as a contact * @param type this is the type to acquire the annotation * @param list this is the list of annotations on the field */ private void process(Field field, Class type, Annotation[] list) throws Exception { Class[] dependents = Reflector.getDependents(field); Annotation label = factory.getInstance(type, dependents); if(label != null) { process(field, label, list); } }
/** * This method is used to process the field an annotation given. * This will check to determine if the field is accessible, if it * is not accessible then it is made accessible so that private * member fields can be used during the serialization process. * * @param field this is the field to be added as a contact * @param type this is the type to acquire the annotation * @param list this is the list of annotations on the field */ private void process(Field field, Class type, Annotation[] list) throws Exception { Class[] dependents = Reflector.getDependents(field); Annotation label = factory.getInstance(type, dependents); if(label != null) { process(field, label, list); } }
/** * This is used to synthesize an XML annotation given a method. The * provided method must follow the Java Bean conventions and either * be a getter or a setter. If this criteria is satisfied then a * suitable XML annotation is created to be used. Typically a match * is performed on whether the method type is a Java collection or * an array, if neither criteria are true a normal XML element is * used. Synthesizing in this way ensures the best results. * * @param method this is the method to extract the annotation for * * @return an XML annotation or null if the method is not suitable */ private Annotation getAnnotation(Method method) throws Exception { Class[] dependents = getDependents(method); Class type = getType(method); if(type != null) { return factory.getInstance(type, dependents); } return null; }
/** * This is used to synthesize an XML annotation given a method. The * provided method must follow the Java Bean conventions and either * be a getter or a setter. If this criteria is satisfied then a * suitable XML annotation is created to be used. Typically a match * is performed on whether the method type is a Java collection or * an array, if neither criteria are true a normal XML element is * used. Synthesizing in this way ensures the best results. * * @param method this is the method to extract the annotation for * * @return an XML annotation or null if the method is not suitable */ private Annotation getAnnotation(Method method) throws Exception { Class[] dependents = getDependents(method); Class type = getType(method); if(type != null) { return factory.getInstance(type, dependents); } return null; }
/** * This is used to synthesize an XML annotation given a method. The * provided method must follow the Java Bean conventions and either * be a getter or a setter. If this criteria is satisfied then a * suitable XML annotation is created to be used. Typically a match * is performed on whether the method type is a Java collection or * an array, if neither criteria are true a normal XML element is * used. Synthesizing in this way ensures the best results. * * @param method this is the method to extract the annotation for * * @return an XML annotation or null if the method is not suitable */ private Annotation getAnnotation(Method method) throws Exception { Class[] dependents = getDependents(method); Class type = getType(method); if(type != null) { return factory.getInstance(type, dependents); } return null; }