/** * Creates and returns a new {@link RevFeatureType} for the given FeatureType with the given * {@link ObjectId id} without verifying the SHA-1 matches the contents of the * {@link RevFeatureType} */ public static RevFeatureType create(ObjectId id, FeatureType ftype) { checkNotNull(id); checkNotNull(ftype); return new RevFeatureTypeImpl(id, ftype); }
/** * @return the name of the feature type */ public @Override Name getName() { return type().getName(); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("FeatureType["); builder.append(getId().toString()); builder.append("; "); boolean first = true; for (PropertyDescriptor desc : descriptors()) { if (first) { first = false; } else { builder.append(", "); } builder.append(desc.getName().getLocalPart()); builder.append(": "); builder.append(desc.getType().getBinding().getSimpleName()); } builder.append(']'); return builder.toString(); } }
/** * @return the name of the feature type */ @Override public Name getName() { Name name = type().getName(); return name; }
public @Override @NonNull RevFeatureType createFeatureType(@NonNull ObjectId id, @NonNull FeatureType ftype) { Collection<PropertyDescriptor> descriptors = ftype.getDescriptors(); descriptors.forEach(d -> { Class<?> binding = d.getType().getBinding(); Objects.requireNonNull(binding, "got null binding for attribute " + d.getName().getLocalPart()); FieldType fieldType = FieldType.forBinding(binding); if (FieldType.NULL == fieldType || FieldType.UNKNOWN == fieldType) { String msg = String.format( "Attribute %s of FeatureType %s is of an unsupported type: %s", d.getName().getLocalPart(), ftype.getName().getLocalPart(), binding.getName()); throw new IllegalArgumentException(msg); } }); return new RevFeatureTypeImpl(id, ftype); }