return getLinkedClass(); case LINKEDTYPE: return getLinkedType(); case MIN: return getMin(); case MANDATORY: return isMandatory(); case READONLY: return isReadonly(); case MAX: return getMax(); case DEFAULT: return getDefaultValue(); case NAME: return getName(); case NOTNULL: return isNotNull(); case REGEXP: return getRegexp(); case TYPE: return getType(); case COLLATE: return getCollate(); case DESCRIPTION: return getDescription();
protected static void validateField(ODocument iRecord, OImmutableProperty p) throws OValidationException { final Object fieldValue; ODocumentEntry entry = iRecord._fields.get(p.getName()); if (entry != null && entry.exist()) { if (p.isNotNull() && fieldValue == null) throw new OValidationException("The field '" + p.getFullName() + "' cannot be null, record: " + iRecord); if (fieldValue != null && p.getRegexp() != null && p.getType().equals(OType.STRING)) { if (!((String) fieldValue).matches(p.getRegexp())) throw new OValidationException( "The field '" + p.getFullName() + "' does not match the regular expression '" + p.getRegexp() + "'. Field value is: " + fieldValue + ", record: " + iRecord); if (p.isMandatory()) { throw new OValidationException("The field '" + p.getFullName() + "' is mandatory, but not found on record: " + iRecord); final OType type = p.getType(); if (!(fieldValue instanceof List)) throw new OValidationException( "The field '" + p.getFullName() + "' has been declared as LINKLIST but an incompatible type is used. Value: " + fieldValue); validateLinkCollection(p, (Collection<Object>) fieldValue, entry); if (!(fieldValue instanceof Set)) throw new OValidationException( "The field '" + p.getFullName() + "' has been declared as LINKSET but an incompatible type is used. Value: "
public OImmutableClass(final OClass oClass, final OImmutableSchema schema) { isAbstract = oClass.isAbstract(); strictMode = oClass.isStrictMode(); this.schema = schema; superClassesNames = oClass.getSuperClassesNames(); superClasses = new ArrayList<OImmutableClass>(superClassesNames.size()); name = oClass.getName(); streamAbleName = oClass.getStreamableName(); clusterSelection = oClass.getClusterSelection(); defaultClusterId = oClass.getDefaultClusterId(); clusterIds = oClass.getClusterIds(); polymorphicClusterIds = oClass.getPolymorphicClusterIds(); baseClassesNames = new ArrayList<String>(); for (OClass baseClass : oClass.getSubclasses()) baseClassesNames.add(baseClass.getName()); overSize = oClass.getOverSize(); classOverSize = oClass.getClassOverSize(); shortName = oClass.getShortName(); properties = new HashMap<String, OProperty>(); for (OProperty p : oClass.declaredProperties()) properties.put(p.getName(), new OImmutableProperty(p, this)); Map<String, String> customFields = new HashMap<String, String>(); for (String key : oClass.getCustomKeys()) customFields.put(key, oClass.getCustom(key)); this.customFields = Collections.unmodifiableMap(customFields); this.description = oClass.getDescription(); }