/** * @param type AttributeType (often attribute.getType() ) * @param attribute Attribute being tested * @param attributeContent Content of the attribute (often attribute.getValue() ) * @throws IllegalAttributeException */ public static void validate(AttributeType type, Attribute attribute, Object attributeContent) throws IllegalAttributeException { validate(type, attribute, attributeContent, false); }
/** * Validates content against an attribute. * * @param attribute The attribute. * @param attributeContent Content of attribute (often attribute.getValue() * @throws IllegalAttributeException In the event that content violates any restrictions * specified by the attribute. */ public static void validate(Attribute attribute, Object attributeContent) throws IllegalAttributeException { validate(attribute.getType(), attribute, attributeContent, false); } /**
public void validate() { Types.validate(getDescriptor(), values[index]); }
public void validate() { Types.validate(this, this.getValue()); }
/** * Validates anattribute. <br> * * <p>Same result as calling: * * <pre> * <code> * validate(attribute.type(), attribute) * </code> * </pre> * * @param attribute The attribute. * @throws IllegalAttributeException In the event that content violates any restrictions * specified by the attribute. */ public static void validate(Attribute attribute) throws IllegalAttributeException { validate(attribute, attribute.getValue()); }
public void validate() { for (int i = 0; i < values.length; i++) { AttributeDescriptor descriptor = getType().getDescriptor(i); Types.validate(descriptor, values[i]); } } }
/** * Adds an attribute value by index. * * * <p>This method can be used to add attribute values out of order. * * @param index The index of the attribute. * @param value The value of the attribute. */ public void set(int index, Object value) { if (index >= values.length) throw new ArrayIndexOutOfBoundsException( "Can handle " + values.length + " attributes only, index is " + index); AttributeDescriptor descriptor = featureType.getDescriptor(index); values[index] = convert(value, descriptor); if (validating) Types.validate(descriptor, values[index]); }
public void validate() { for (int i = 0; i < values.length; i++) { AttributeDescriptor descriptor = getType().getDescriptor(i); Types.validate(descriptor, values[i]); } }
/** * Ensures an attribute value is withing the restrictions of the AttributeDescriptor and * AttributeType. * * @param attribute * @return true if the attribute value is valid */ public static boolean isValid(Attribute attribute) { try { validate(attribute.getType(), attribute, attribute.getValue(), false); return true; } catch (IllegalAttributeException invalid) { return false; } } /**
/** Ensure that attributeContent is a good value for descriptor. */ public static void validate(AttributeDescriptor descriptor, Object value) throws IllegalAttributeException { if (descriptor == null) { throw new NullPointerException("Attribute descriptor required for validation"); } if (value == null) { if (!descriptor.isNillable()) { throw new IllegalArgumentException( descriptor.getName() + " requires a non null value"); } } else { validate(descriptor.getType(), value, false); } }
public void setAttribute(int index, Object value) throws IndexOutOfBoundsException { // first do conversion Object converted = Converters.convert( value, getFeatureType().getDescriptor(index).getType().getBinding()); // if necessary, validation too if (validating) Types.validate(featureType.getDescriptor(index), converted); // finally set the value into the feature values[index] = converted; }
validate(type.getSuper(), value, true);
/** * * @param type AttributeType (often attribute.getType() ) * @param attribute Attribute being tested * @param attributeContent Content of the attribute (often attribute.getValue() ) * @throws IllegalAttributeException */ public static void validate(AttributeType type, Attribute attribute, Object attributeContent) throws IllegalAttributeException { validate(type, attribute, attributeContent, false); }
validate(type.getSuper(), attribute, attributeContent, true);
public void validate() { for (int i = 0; i < values.length; i++) { AttributeDescriptor descriptor = getType().getDescriptor(i); Types.validate(descriptor, values[i]); } }
@Override public void validate() { Types.validate(getDescriptor(), getValue()); }
@Override public void validate() throws IllegalAttributeException { for (int i = 0; i < revFeatureValues.size(); i++) { AttributeDescriptor descriptor = getType().getDescriptor(i); Types.validate(descriptor, getAttribute(i)); } } }
@Override public void validate() throws IllegalAttributeException { for (int i = 0; i < getAttributeCount(); i++) { AttributeDescriptor descriptor = getType().getDescriptor(i); Types.validate(descriptor, getAttribute(i)); } } }
public void setAttribute(int index, Object value) throws IndexOutOfBoundsException { // first do conversion Object converted = Converters.convert(value, getFeatureType().getDescriptor(index).getType().getBinding()); // if necessary, validation too if(validating) Types.validate(featureType.getDescriptor(index), converted); // finally set the value into the feature values[index] = converted; }