public String toString() { StringBuilder sb = new StringBuilder(); sb.append(type.getSimpleName()); if (parent != null) { sb.append("@"); sb.append(parent); } return sb.toString(); }
@Nonnull @Override public Result<String> alias(TypeDescriptor type) { return Result.of(type.getSimpleName()); }
public String getSimpleName() { return getSimpleName(getRawType()); }
public static BasicObjectType of(TypeDescriptor type) { return of(type, type.getSimpleName(), null); }
public static BasicObjectType of(TypeDescriptor type, @Nullable Set<String> fieldNames) { return of(type, type.getSimpleName(), fieldNames); }
private void add(String name, AccessibleProperty property, TypeContext typeContext) { if (!property.isWritable() && !creatorParameters.contains(name)) { throw new IllegalArgumentException(type.getSimpleName() + "." + name + " should have a matching setter or constructor parameter"); } SubPath subPath = path.property(name); if (!properties.containsKey(name)) { properties.put(name, property); context.describeAsync(subPath, typeContext); } }
private void assignConstructor(TypeDescriptor type) { type.getConstructors().values().forEach(this::add); type.getMethods().values().forEach(this::add); if (!type.isAbstract()) { Check.that(creator.isPreset(), "%s: creator method or constructor not found.", type.getSimpleName()); creatorParameters = ImmutableSet.copyOf(getCreatorParameters()); } }
private void setIdentifier(String name, AccessibleProperty property, TypeContext typeContext) { if (identifier != null) { throw new IllegalArgumentException(type.getSimpleName() + " should not have multiple @Id-properties"); } IdentifiableType idType; if (property.isWritable() || creatorParameters.contains(name)) { idType = (IdentifiableType) context.describeNow(path.property(name), typeContext); } else { idType = (IdentifiableType) context.describeNow(null, typeContext); } identifier = new ObjectIdentifier(property, idType, name); }
private String getParameterName(ParameterDescriptor parameter) { return Check.notNull(context.getMappingResolver().name(parameter), type.getSimpleName() + " parameter name").value; }