/** * 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); }