public final class CommonUtils extends Object
| Constructor and Description |
|---|
CommonUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addAnnotation(com.sun.codemodel.JVar field,
com.sun.codemodel.JAnnotationUse annotation)
Append the given
annotation to list of annotations for the given field. |
static void |
copyAnnotationMemberValue(com.sun.codemodel.JAnnotationUse sourceAnnotation,
String annotationMember,
String defaultAnotationValue,
com.sun.codemodel.JAnnotationUse targetAnnotation)
Copies the annotation member with a given name from source annotations to target annotations.
|
static <S,D extends S> |
copyFields(S src,
D dest)
Perform the copying of all fields from
src to dest. |
static String |
generableToString(com.sun.codemodel.JGenerable generable)
Returns the string value of passed argument.
|
static com.sun.codemodel.JAnnotationUse |
getAnnotation(com.sun.codemodel.JAnnotatable annotatable,
com.sun.codemodel.JClass annotationClass)
Returns the annotation for the given field.
|
static com.sun.codemodel.JAnnotationValue |
getAnnotationMember(com.sun.codemodel.JAnnotationUse annotation,
String annotationMember)
Returns the annotation element as
JAnnotationValue. |
static String |
getAnnotationMemberValue(com.sun.codemodel.JAnnotationUse annotation,
String annotationMember)
Returns the value of annotation element as string.
|
static <T> T |
getPrivateField(Object obj,
String fieldName)
Get the value of private field
fieldName of given object obj. |
static com.sun.xml.xsom.XSDeclaration |
getXsdDeclaration(com.sun.tools.xjc.model.CPropertyInfo propertyInfo)
Returns XSD declaration of given property.
|
static boolean |
hasPropertyNameCustomization(com.sun.tools.xjc.model.CPropertyInfo fieldPropertyInfo)
Check that given field property has name customization (
<jaxb:property name="..." />). |
static boolean |
isHiddenClass(com.sun.codemodel.JClass clazz)
Returns
true if given class is hidden, that is not generated and saved by XJC. |
static boolean |
isListedAsParametrisation(com.sun.codemodel.JClass classToCheck,
com.sun.codemodel.JType type)
Returns
true of the given type is JClass and contains classToCheck
in the list of parametrisation. |
static void |
setPrivateField(Object obj,
String fieldName,
Object newValue)
Set the
newValue to private field fieldName of given object obj. |
public static boolean isHiddenClass(com.sun.codemodel.JClass clazz)
true if given class is hidden, that is not generated and saved by XJC. These are for example
instances of JCodeModel.JReferencedClass (JVM-wide classes) or instances of JDefinedClass with
hidden flag (customized super-class or super-interface).public static boolean isListedAsParametrisation(com.sun.codemodel.JClass classToCheck,
com.sun.codemodel.JType type)
true of the given type is JClass and contains classToCheck
in the list of parametrisation.public static com.sun.codemodel.JAnnotationUse getAnnotation(com.sun.codemodel.JAnnotatable annotatable,
com.sun.codemodel.JClass annotationClass)
annotatable.public static com.sun.codemodel.JAnnotationValue getAnnotationMember(com.sun.codemodel.JAnnotationUse annotation,
String annotationMember)
JAnnotationValue.public static void copyAnnotationMemberValue(com.sun.codemodel.JAnnotationUse sourceAnnotation,
String annotationMember,
String defaultAnotationValue,
com.sun.codemodel.JAnnotationUse targetAnnotation)
public static String getAnnotationMemberValue(com.sun.codemodel.JAnnotationUse annotation, String annotationMember)
@XmlElementRef(name = "last-name", namespace = "http://mycompany.org/exchange", type = JAXBElement.class)
for member name the value "last-name" will be returned, for member type
the value "jakarta.xml.bind.JAXBElement.class" will be returned.public static void addAnnotation(com.sun.codemodel.JVar field,
com.sun.codemodel.JAnnotationUse annotation)
annotation to list of annotations for the given field.public static boolean hasPropertyNameCustomization(com.sun.tools.xjc.model.CPropertyInfo fieldPropertyInfo)
<jaxb:property name="..." />). See also
org.glassfish.jaxb.core.api.impl.NameUtil.JJavaName,
BIProperty.getCustomization(XSComponent)public static String generableToString(com.sun.codemodel.JGenerable generable)
public static void setPrivateField(Object obj, String fieldName, Object newValue)
newValue to private field fieldName of given object obj.IllegalArgumentException - if given field was not foundpublic static <T> T getPrivateField(Object obj, String fieldName)
fieldName of given object obj.IllegalArgumentException - if given field was not foundpublic static <S,D extends S> void copyFields(S src,
D dest)
throws IllegalArgumentException
src to dest. The code was copied from
org.springframework.util.ReflectionUtils#shallowCopyFieldState(Object, Object).IllegalArgumentExceptionpublic static com.sun.xml.xsom.XSDeclaration getXsdDeclaration(com.sun.tools.xjc.model.CPropertyInfo propertyInfo)
Copyright © 2022–2023. All rights reserved.