Package se.unlogic.standardutils.string

Examples of se.unlogic.standardutils.string.Stringyfier


            if(StringUtils.isEmpty(name)){

              name = field.getName();
            }

            Stringyfier valueFormatter = null;

            if(elementAnnotation.valueFormatter() != DummyStringyfier.class){

              try {
                valueFormatter = elementAnnotation.valueFormatter().newInstance();

              } catch (InstantiationException e) {

                throw new RuntimeException(e);

              } catch (IllegalAccessException e) {

                throw new RuntimeException(e);
              }
            }

            if(Collection.class.isAssignableFrom(field.getType())){

              boolean elementable = false;

              if(ReflectionUtils.isGenericlyTyped(field) && Elementable.class.isAssignableFrom((Class<?>) ReflectionUtils.getGenericType(field))){

                elementable = true;
              }

              String childName = elementAnnotation.childName();

              if(StringUtils.isEmpty(childName)){

                childName = "value";
              }

              annotatedFields.add(new FieldXMLInfo(name, field, FieldType.Element,elementAnnotation.cdata(),elementable,true,false,childName,elementAnnotation.skipChildParentElement(),valueFormatter));

            }else if(field.getType().isArray()){

              boolean elementable = false;

              if(Elementable.class.isAssignableFrom(field.getType())){

                elementable = true;
              }

              String childName = elementAnnotation.childName();

              if(StringUtils.isEmpty(childName)){

                childName = "value";
              }

              annotatedFields.add(new FieldXMLInfo(name, field, FieldType.Element,elementAnnotation.cdata(),elementable,false,true,childName,elementAnnotation.skipChildParentElement(),valueFormatter));

            }else{

              String childName = null;

              if(!StringUtils.isEmpty(elementAnnotation.childName())){

                childName = elementAnnotation.childName();
              }

              annotatedFields.add(new FieldXMLInfo(name, field, FieldType.Element,elementAnnotation.cdata(),Elementable.class.isAssignableFrom(field.getType()),false,false,childName,false,valueFormatter));
            }

            ReflectionUtils.fixFieldAccess(field);
          }

          XMLAttribute attributeAnnotation = field.getAnnotation(XMLAttribute.class);

          if(attributeAnnotation != null){

            String name = attributeAnnotation.name();

            if(StringUtils.isEmpty(name)){

              name = field.getName();
            }

            Stringyfier valueFormatter = null;

            if(attributeAnnotation.valueFormatter() != DummyStringyfier.class){

              try {
                valueFormatter = attributeAnnotation.valueFormatter().newInstance();
View Full Code Here


            if(StringUtils.isEmpty(name)){

              name = field.getName();
            }

            Stringyfier valueFormatter = null;

            if(elementAnnotation.valueFormatter() != DummyStringyfier.class){

              try {
                valueFormatter = elementAnnotation.valueFormatter().newInstance();

              } catch (InstantiationException e) {

                throw new RuntimeException(e);

              } catch (IllegalAccessException e) {

                throw new RuntimeException(e);
              }
            }

            if(Collection.class.isAssignableFrom(field.getType())){

              boolean elementable = false;

              if(ReflectionUtils.isGenericlyTyped(field) && Elementable.class.isAssignableFrom((Class<?>) ReflectionUtils.getGenericType(field))){

                elementable = true;
              }

              String childName = elementAnnotation.childName();

              if(StringUtils.isEmpty(childName)){

                childName = "value";
              }

              annotatedFields.add(new FieldXMLInfo(name, field, FieldType.Element,elementAnnotation.cdata(),elementable,true,false,childName,elementAnnotation.skipChildParentElement(),valueFormatter));

            }else if(field.getType().isArray()){

              boolean elementable = false;

              if(Elementable.class.isAssignableFrom(field.getType())){

                elementable = true;
              }

              String childName = elementAnnotation.childName();

              if(StringUtils.isEmpty(childName)){

                childName = "value";
              }

              annotatedFields.add(new FieldXMLInfo(name, field, FieldType.Element,elementAnnotation.cdata(),elementable,false,true,childName,elementAnnotation.skipChildParentElement(),valueFormatter));

            }else{

              String childName = null;

              if(!StringUtils.isEmpty(elementAnnotation.childName())){

                childName = elementAnnotation.childName();
              }

              annotatedFields.add(new FieldXMLInfo(name, field, FieldType.Element,elementAnnotation.cdata(),Elementable.class.isAssignableFrom(field.getType()),false,false,childName,false,valueFormatter));
            }

            ReflectionUtils.fixFieldAccess(field);
          }

          XMLAttribute attributeAnnotation = field.getAnnotation(XMLAttribute.class);

          if(attributeAnnotation != null){

            String name = attributeAnnotation.name();

            if(StringUtils.isEmpty(name)){

              name = field.getName();
            }

            Stringyfier valueFormatter = null;

            if(attributeAnnotation.valueFormatter() != DummyStringyfier.class){

              try {
                valueFormatter = attributeAnnotation.valueFormatter().newInstance();
View Full Code Here

TOP

Related Classes of se.unlogic.standardutils.string.Stringyfier

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.