@Beta public static RegisteredType addTag(RegisteredType type, Object tag) { if (tag != null) { ((BasicRegisteredType) type).tags.add(tag); } return type; }
@Beta public static RegisteredType addAlias(RegisteredType type, String alias) { if (alias != null) { ((BasicRegisteredType) type).aliases.add(alias); } return type; }
@Beta public static RegisteredType addSuperType(RegisteredType type, @Nullable Class<?> superType) { if (superType != null) { ((BasicRegisteredType) type).superTypes.add(superType); } return type; }
/** * @deprecated since it was introduced in 0.9.0; for backwards compatibility only, may be removed * at any point */ @Deprecated public static RegisteredType of(CatalogItem<?, ?> item) { if (item == null) return null; TypeImplementationPlan impl = null; if (item.getPlanYaml() != null) { impl = new BasicTypeImplementationPlan(null, item.getPlanYaml()); } else if (item.getJavaType() != null) { impl = new JavaClassNameTypeImplementationPlan(item.getJavaType()); } else { throw new IllegalStateException( "Unsupported catalog item " + item + " when trying to create RegisteredType"); } BasicRegisteredType type = (BasicRegisteredType) spec(item.getSymbolicName(), item.getVersion(), impl, item.getCatalogItemJavaType()); type.displayName = item.getDisplayName(); type.description = item.getDescription(); type.iconUrl = item.getIconUrl(); type.disabled = item.isDisabled(); type.deprecated = item.isDeprecated(); if (item.getLibraries() != null) type.bundles.addAll(item.getLibraries()); // aliases aren't on item if (item.tags() != null) type.tags.addAll(item.tags().getTags()); // these things from item we ignore: javaType, specType, registeredTypeName ... return type; }
@Beta public static RegisteredType addSuperType( RegisteredType type, @Nullable RegisteredType superType) { if (superType != null) { if (isSubtypeOf(superType, type)) { throw new IllegalStateException( superType + " declares " + type + " as a supertype; cannot set " + superType + " as a supertype of " + type); } ((BasicRegisteredType) type).superTypes.add(superType); } return type; }
@Beta public static void cacheActualJavaType(RegisteredType type, Class<?> clazz) { ((BasicRegisteredType) type).getCache().put(ACTUAL_JAVA_TYPE, clazz); }