Here you can find the source of isAttribute(Object obj)
Parameter | Description |
---|---|
obj | a parameter |
public static boolean isAttribute(Object obj)
//package com.java2s; // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell import java.lang.annotation.Annotation; import java.lang.reflect.Field; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAttribute; public class Main { /** Checks if the class field is XML attribute. * /*from w w w . ja va 2 s . co m*/ * @param obj * * @return boolean * * */ public static boolean isAttribute(Object obj) { boolean ret = false; if (null != obj) { Class<?> clazz = obj.getClass(); Annotation annotation = clazz.getAnnotation(XmlAnyAttribute.class); if (null != annotation) { ret = true; } } return ret; } /** Checks if the class filed is XML attribute * * @param f * * @return boolean * * */ public static boolean isAttribute(Field f) { boolean ret = false; if (null != f) { Annotation annotation = f.getAnnotation(XmlAttribute.class); if (null != annotation) { ret = true; } } return ret; } }