Adds an annotated Class to xmlJmapper structure.
@param aClass Class to convert to XmlClass
@return this instance of XML
273
private XML addClass(Class<?> aClass){
		xmlJmapper.classes.add(Converter.toXmlClass(aClass));
		return this;
	}
1191281
private static LinkedList<Field> initializeNonRequiredFields(final Class<?> aClass) {

        final LinkedList<Field> result = new LinkedList();
        final Field[] fields = aClass.getDeclaredFields();
        for (final Field f : fields) {
            if (f.getType().isArray()) {
                final XmlElementWrapper xmlElementWrapper = f.getAnnotation(XmlElementWrapper.class);
                if (xmlElementWrapper != null) {
                    if (!xmlElementWrapper.required()) {
                        result.add(f);
                    }
                } else {
                    final XmlElement xmlElement = f.getAnnotation(XmlElement.class);
                    if (xmlElement != null && !xmlElement.required()) {
                        result.add(f);
                    }
                }
            } else if (!f.getType().isPrimitive()) {
                if (f.getType().isEnum()) {
                    if (FixedType.class.equals(f.getType())) {
                        result.add(f);
                    } else if (BlockType.class.equals(f.getType())) {
                        result.add(f);
                    } else if (TierBlockPolicy.class.equals(f.getType())) {
                        result.add(f);
                    }
                } else if (Integer.class.equals(f.getType())) {
                    result.add(f);
                } else if (Double.class.equals(f.getType())) {
                    result.add(f);
                }
            }
        }
        return result;
    }
557243
@SuppressWarnings("unchecked")
	public static <T> T newInstance(Class<?> aClass) 
	{
		if(aClass == null)
			return null;
		
				try
				{
					if(String.class.equals(aClass))
					{
						return (T)"";
					}
					else if(Integer.class.equals(aClass))
					{
						return (T)Integer.valueOf(0);
					}
					else if(Date.class.equals(aClass))
					{
						return (T)Calendar.getInstance().getTime();
					}				
					else if(Long.class.equals(aClass) ||
							long.class.equals(aClass))
					{
						return (T)Long.valueOf(0);
					}		
					else if(Character.class.equals(aClass) ||
							char.class.equals(aClass) )
					{
						return (T) Character.valueOf('\0');
					}
					else if(Float.class.equals(aClass) ||
							float.class.equals(aClass))
					{
						return (T)Float.valueOf(0);
					}
					else if(Double.class.equals(aClass) || 
						   double.class.equals(aClass))
					{
						return (T)Double.valueOf(0);
					}				
					
					Constructor<T> constructor = (Constructor<T>)aClass.getDeclaredConstructor();
					
					
					return (T)constructor.newInstance();
					
				}
				catch(IllegalAccessException e)
				{
					throw new SetupException("Trying to create "+aClass.getName()+" "+e.getMessage());
				}
				catch(NoSuchMethodException | InvocationTargetException | InstantiationException e)
				{
						//Get constructor
						Constructor<?>[] constructors = aClass.getConstructors();
							
						int len = constructors.length;
						for(int i=0; i < len; i++)
						{
							Class<?>[] parameterTypes = constructors[i].getParameterTypes();
						    
							if(parameterTypes == null || parameterTypes.length == 0)
								throw new SetupException("Trying to create "+aClass.getName()+" "+e.getMessage()); //has a default constructor but not able to create it
							
							//Construct arguments
							Object[] initargs = new Object[parameterTypes.length];
							
							for(int argsIndex=0; argsIndex <  initargs.length;argsIndex++)
							{
								initargs[argsIndex] = newInstance(parameterTypes[argsIndex]);
							}
							
							try
							{
								return (T)constructors[i].newInstance(initargs);
							}
							catch(Exception exception)
							{}
						}//end for constructors
						
						//not able to success use another constructor
						throw new SetupException("Trying to create class with name:"+aClass.getName()+" ERROR:"+e.getMessage());	
					}//end catch
			}
24857
@Nonnull
  public static <T> EbInterfaceWriter <T> create (@Nonnull final Class <T> aClass)
  {
    return new EbInterfaceWriter <> (aClass);
  }
419034
public static List<Class<?>> getAllsuperClasses(Class<?> aClass){
		List<Class<?>> result = new ArrayList<Class<?>>();
		result.add(aClass);
		Class<?> superclass = aClass.getSuperclass();
		while(!isNull(superclass) && superclass != Object.class){
			result.add(superclass);
			superclass = superclass.getSuperclass();
		}
		return result;
	}
819740
@Nonnull
  public static <T> EbInterfaceReader <T> create (@Nonnull final Class <T> aClass)
  {
    return new EbInterfaceReader <> (aClass);
  }
368180
public static void xmlGlobalExistent(Class<?> aClass) {
		throw new XmlMappingGlobalExistException(MSG.INSTANCE.message(xmlMappingGlobalExistException, aClass.getSimpleName()));
	}
1315781
public <A extends Annotation> Optional<A> getAnnotation(final Class<A> annoClass) {
        Objects.requireNonNull(annoClass, "annoClass should not be null.");
        
        return getAnnotationsByType(expandedAnnos, annoClass).stream()
                .findFirst();
        
    }
867240
public <A extends Annotation> A annotation(Class<A> annotationClass) {
        return field.getAnnotation(annotationClass);
    }
138844
public static JAnnotationUse getAnnotation(JAnnotatable annotatable, JClass annotationClass) {
		for (JAnnotationUse annotation : annotatable.annotations()) {
			if (annotation.getAnnotationClass().equals(annotationClass)) {
				return annotation;
			}
		}

		return null;
	}
187630
public static void xmlAttributeInexistent(String path, String attributeName, Class<?> aClass){
		throw new XmlMappingAttributeDoesNotExistException (MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,attributeName,aClass.getSimpleName(),path));
	}
336873
@Nullable
  public static Class <?> getPrimitiveClass (@Nullable final Class <?> aClass)
  {
    if (isPrimitiveType (aClass))
      return aClass;
    return WRAPPER_TO_PRIMITIVE.get (aClass);
  }
1119356
@Nonnull
  public static <T> UBLPEValidatorBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBLPEValidatorBuilder <> (aClass);
  }
73898
public static <T extends Annotation> T getAnnotation(final Class<?> componentClass,
		final Class<T> annotationClass)
	{
		T annotation = componentClass.getAnnotation(annotationClass);
		if (annotation != null)
		{
			return annotation;
		}
		for (final Class<?> ifc : componentClass.getInterfaces())
		{
			annotation = getAnnotation(ifc, annotationClass);
			if (annotation != null)
			{
				return annotation;
			}
		}
		if (!Annotation.class.isAssignableFrom(componentClass))
		{
			for (final Annotation ann : componentClass.getAnnotations())
			{
				annotation = getAnnotation(ann.annotationType(), annotationClass);
				if (annotation != null)
				{
					return annotation;
				}
			}
		}
		final Class<?> superClass = componentClass.getSuperclass();
		if (superClass == null || superClass.equals(Object.class))
		{
			return null;
		}
		return getAnnotation(superClass, annotationClass);
	}
410508
public T create(final Class<T> klass) {
    T obj;
    try {
      obj = (T) klass.newInstance();
    }
    catch (IllegalAccessException e) {
      throw new DocrepException(e);
    }
    catch (InstantiationException e) {
      throw new DocrepException(e);
    }
    add(obj);
    return obj;
  }
1041245
@Nonnull
  public static <T> UBL22ReaderBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBL22ReaderBuilder<> (aClass);
  }
518564
public static List<Property> buildFieldProperties(final Class<?> aClass) {
        DescriptionBuilder builder = DescriptionBuilder.builder();
        buildFieldProperties(aClass, builder);
        return builder.buildProperties();
    }