public boolean required() { return core.required(); }
AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) { super(parent,seed); XmlAttribute att = seed.readAnnotation(XmlAttribute.class); assert att!=null; if(att.required()) isRequired = true; else isRequired = nav().isPrimitive(getIndividualType()); this.xmlName = calcXmlName(att); }
public boolean required() { return core.required(); }
@Override public Boolean hasRequiredMarker(AnnotatedMember m) { // 17-Oct-2017, tatu: [modules-base#32] // Before 2.9.3, was handling `true` correctly, // but otherwise used confusing logic (probably in attempt to try to avoid // reporting not-required for default value case XmlAttribute attr = m.getAnnotation(XmlAttribute.class); if (attr != null) { return attr.required(); } XmlElement elem = m.getAnnotation(XmlElement.class); if (elem != null) { return elem.required(); } return null; }
AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) { super(parent,seed); XmlAttribute att = seed.readAnnotation(XmlAttribute.class); assert att!=null; if(att.required()) isRequired = true; else isRequired = nav().isPrimitive(getIndividualType()); this.xmlName = calcXmlName(att); }
/** * Whether the attribute is required. * * @return Whether the attribute is required. */ public boolean isRequired() { boolean required = false; if (xmlAttribute != null) { required = xmlAttribute.required(); } return required; } }
public boolean required() { return core.required(); }
public boolean required() { return core.required(); }
/** * Whether the attribute is required. * * @return Whether the attribute is required. */ public boolean isRequired() { return xmlAttribute != null && xmlAttribute.required() || (getAccessorType() instanceof PrimitiveType); }
private static boolean containsRequiredFieldWithoutDefault(Class<?> type) { while (type != Object.class) { for (Field field : type.getDeclaredFields()) { if (field.isAnnotationPresent(XmlDefaultValue.class)) { continue; } XmlElement annotation = field.getAnnotation(XmlElement.class); XmlAttribute annotation2 = field.getAnnotation(XmlAttribute.class); if (annotation != null && annotation.required()) { return true; } if (annotation2 != null && annotation2.required()) { return true; } } type = type.getSuperclass(); } return false; } }
/** * Whether the attribute is required. * * @return Whether the attribute is required. */ public boolean isRequired() { boolean required = BeanValidationUtils.isNotNull(this); if (xmlAttribute != null && !required) { required = xmlAttribute.required(); } return required || (getAccessorType().isPrimitive()); }
/** * Whether the attribute is required. * * @return Whether the attribute is required. */ public boolean isRequired() { boolean required = BeanValidationUtils.isNotNull(this); if (xmlAttribute != null && !required) { required = xmlAttribute.required(); } return required || (getAccessorType().isPrimitive()); }
@Override public Boolean hasRequiredMarker(AnnotatedMember m) { // 17-Oct-2017, tatu: [modules-base#32] // Before 2.9.3, was handling `true` correctly, // but otherwise used confusing logic (probably in attempt to try to avoid // reporting not-required for default value case XmlAttribute attr = m.getAnnotation(XmlAttribute.class); if (attr != null) { return attr.required(); } XmlElement elem = m.getAnnotation(XmlElement.class); if (elem != null) { return elem.required(); } return null; }
@Override public Boolean hasRequiredMarker(AnnotatedMember m) { XmlElement elem = m.getAnnotation(XmlElement.class); if ((elem != null) && elem.required()) { return Boolean.TRUE; } XmlAttribute attr = m.getAnnotation(XmlAttribute.class); if ((attr != null) && attr.required()) { return Boolean.TRUE; } // 09-Sep-2015, tatu: Not 100% sure that we should ever return `false` // here (as it blocks calls to secondary introspector), but since that // was the existing behavior before 2.6, is retained for now. if ((elem != null) || (attr != null)) { return null; } return Boolean.FALSE; }
@Override public Boolean hasRequiredMarker(AnnotatedMember m) { XmlElement elem = m.getAnnotation(XmlElement.class); if ((elem != null) && elem.required()) { return Boolean.TRUE; } XmlAttribute attr = m.getAnnotation(XmlAttribute.class); if ((attr != null) && attr.required()) { return Boolean.TRUE; } // 09-Sep-2015, tatu: Not 100% sure that we should ever return `false` // here (as it blocks calls to secondary introspector), but since that // was the existing behavior before 2.6, is retained for now. if ((elem != null) || (attr != null)) { return null; } return Boolean.FALSE; }
@Override public VisitorAction visit(PMMLObject object){ List<Field> fields = ReflectionUtil.getInstanceFields(object.getClass()); for(Field field : fields){ Object value = ReflectionUtil.getFieldValue(field, object); if(value instanceof List){ List<?> collection = (List<?>)value; // The getter method may have initialized the field with an empty ArrayList instance if(collection.size() == 0){ value = null; } } // End if // The field is set if(value != null){ continue; } XmlElement element = field.getAnnotation(XmlElement.class); if(element != null && element.required()){ report(new MissingElementException(object, field)); } XmlAttribute attribute = field.getAnnotation(XmlAttribute.class); if(attribute != null && attribute.required()){ report(new MissingAttributeException(object, field)); } } return super.visit(object); }
AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) { super(parent,seed); XmlAttribute att = seed.readAnnotation(XmlAttribute.class); assert att!=null; if(att.required()) isRequired = true; else isRequired = nav().isPrimitive(getIndividualType()); this.xmlName = calcXmlName(att); }
AttributePropertyInfoImpl(ClassInfoImpl<TypeT,ClassDeclT,FieldT,MethodT> parent, PropertySeed<TypeT,ClassDeclT,FieldT,MethodT> seed ) { super(parent,seed); XmlAttribute att = seed.readAnnotation(XmlAttribute.class); assert att!=null; if(att.required()) isRequired = true; else isRequired = nav().isPrimitive(getIndividualType()); this.xmlName = calcXmlName(att); }
property.setIsRequired(((XmlAttribute) helper.getAnnotation(propertyElement, XmlAttribute.class)).required());
property.setIsRequired(((XmlAttribute) helper.getAnnotation(propertyElement, XmlAttribute.class)).required());