@Override public boolean isSuperTypeOf(Type type) { Type t = type; do { if (this == t) { return true; } t = t.getSuperType(); } while (t != null); return false; }
protected void walkSimpleType(Type type, String path, String addPrefix) { while (type instanceof SimpleTypeImpl) { // type with constraint type = type.getSuperType(); } if (type instanceof StringType) { simplePaths.add(path); if (addPrefix != null) { simplePaths.add(addPrefix + ":" + path); } } else if (type instanceof BinaryType) { binaryPaths.add(path); if (addPrefix != null) { binaryPaths.add(addPrefix + ":" + path); } } } }
@Override public Type[] getTypeHierarchy() { Type type = getSuperType(); if (type == null) { return EMPTY_SUPERTYPES; } List<Type> types = new ArrayList<Type>(); while (type != null) { types.add(type); type = type.getSuperType(); } return types.toArray(new Type[types.size()]); }
protected static Class getFieldClass(Type fieldType) { Class klass = JavaTypes.getClass(fieldType); // for enumerated SimpleTypes we may need to lookup on the supertype // we do the recursion here and not in JavaTypes to avoid potential impacts if (klass == null) { assert fieldType.getSuperType() != null; return getFieldClass(fieldType.getSuperType()); } return klass; }
if (type instanceof SimpleTypeImpl) { type = type.getSuperType();
/** * Converts a Nuxeo core schema field type into a property type. * * @param fieldType the field type to convert * @param array {@code true} if an array type is required * @return */ public static PropertyType fromFieldType(Type fieldType, boolean array) { if (fieldType instanceof StringType) { return array ? ARRAY_STRING : STRING; } else if (fieldType instanceof BooleanType) { return array ? ARRAY_BOOLEAN : BOOLEAN; } else if (fieldType instanceof LongType) { return array ? ARRAY_LONG : LONG; } else if (fieldType instanceof DoubleType) { return array ? ARRAY_DOUBLE : DOUBLE; } else if (fieldType instanceof DateType) { return array ? ARRAY_DATETIME : DATETIME; } else if (fieldType instanceof BinaryType) { return array ? ARRAY_BINARY : BINARY; } else if (fieldType instanceof IntegerType) { throw new RuntimeException("Unimplemented primitive type: " + fieldType.getClass().getName()); } else if (fieldType instanceof SimpleTypeImpl) { // simple type with constraints -- ignore constraints XXX return fromFieldType(fieldType.getSuperType(), array); } else { throw new RuntimeException("Invalid primitive type: " + fieldType.getClass().getName()); } }
protected boolean isDomain(DocumentModel documentModel) { Type type = documentModel.getDocumentType(); while (type != null) { if ("Domain".equals(type.getName())) { return true; } type = type.getSuperType(); } return false; }
protected boolean isTypeRelation(String typeName) { do { if (TYPE_RELATION.equals(typeName)) { return true; } Type t = schemaManager.getDocumentType(typeName); if (t != null) { t = t.getSuperType(); } typeName = t == null ? null : t.getName(); } while (typeName != null); return false; }
} else if (type instanceof SimpleTypeImpl) { return typedArray(type.getSuperType(), array); } else { throw new RuntimeException("Invalid primitive type: " + type.getClass().getName());
protected static ColumnType fromFieldType(Type type, int maxLength, boolean array) { if (type instanceof StringType) { if (maxLength == -1) { return array ? ARRAY_STRING : STRING; // unconstrained } else { return new ColumnType(ColumnSpec.STRING, maxLength, array); } } else if (type instanceof BooleanType) { return array ? ARRAY_BOOLEAN : BOOLEAN; } else if (type instanceof LongType) { return array ? ARRAY_LONG : LONG; } else if (type instanceof DoubleType) { return array ? ARRAY_DOUBLE : DOUBLE; } else if (type instanceof DateType) { return array ? ARRAY_TIMESTAMP : TIMESTAMP; } else if (type instanceof BinaryType) { return array ? ARRAY_BLOBID : BLOBID; } else if (type instanceof IntegerType) { return array ? ARRAY_INTEGER : INTEGER; } else if (type instanceof SimpleTypeImpl) { // comes from a constraint return fromFieldType(type.getSuperType(), maxLength); } else { throw new RuntimeException("Invalid primitive type: " + type.getClass().getName()); } }
for (Type p = parent; p != null; p = p.getSuperType()) { Set<String> set = documentTypesExtending.get(p.getName()); set.add(name);
protected static Type getBaseType(Type type) { if (type instanceof SimpleTypeImpl) { return getBaseType(type.getSuperType()); } if (type instanceof ListType) { return getBaseType(((ListType) type).getFieldType()); } return type; }
if (type instanceof SimpleTypeImpl) { type = type.getSuperType();
if (type instanceof SimpleTypeImpl) { type = type.getSuperType();
if (type instanceof SimpleTypeImpl) { type = type.getSuperType();
itemConstraints = type.getConstraints(); while (!(type instanceof PrimitiveType)) { type = type.getSuperType(); Type type = field.getType(); while (!(type instanceof PrimitiveType)) { type = type.getSuperType();
} else if (input == DateType.INSTANCE) { return LogicalTypes.timestampMillis().addToSchema(Schema.create(org.apache.avro.Schema.Type.LONG)); } else if (input.getSuperType() != null && input.getSuperType().isSimpleType()) { return new LogicalType(getName(input)).addToSchema(createSchema(input.getSuperType()));
if (resolver == null) { assert type.getSuperType() instanceof StringType; Blob blob = readEntity(Blob.class, Blob.class, jn); if (blob == null) {
if (type instanceof SimpleTypeImpl) { type = type.getSuperType();