@TypeValue(JavaAnnotationListTypeValueModel.TYPE) public interface JavaAnnotationListTypeValueModel extends JavaAnnotationTypeValueModel, WindupVertexListModel<JavaAnnotationTypeValueModel> { public static final String TYPE = "JavaAnnotationListTypeValueModel"; }
/** * Returns the type discriminator value for given Frames model class, extracted from the @TypeValue annotation. */ public static String getTypeValue(Class<? extends WindupFrame> clazz) { TypeValue typeValueAnnotation = clazz.getAnnotation(TypeValue.class); if (typeValueAnnotation == null) throw new IllegalArgumentException("Class " + clazz.getCanonicalName() + " lacks a @TypeValue annotation"); return typeValueAnnotation.value(); }
/** * Returns the type discriminator value for given Frames model class, extracted from the @TypeValue annotation. */ public static String getTypeValue(Class<? extends WindupFrame> clazz) { TypeValue typeValueAnnotation = clazz.getAnnotation(TypeValue.class); if (typeValueAnnotation == null) throw new IllegalArgumentException("Class " + clazz.getCanonicalName() + " lacks a @TypeValue annotation"); return typeValueAnnotation.value(); }
/** * Indicates that an Archive file can be ignored. * * @author <a href="mailto:ozizka@redhat.com">Ondrej Zizka</a> * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @TypeValue(IgnoredArchiveModel.TYPE) public interface IgnoredArchiveModel extends ArchiveModel, IgnoredFileModel { String TYPE = "IgnoredArchiveModel"; }
public String getFrameDiscriminator() { if (frameType.getAnnotation(TypeValue.class) == null) { throw new IllegalStateException("Missing @" + TypeValue.class.getSimpleName() + ": " + frameType.getName()); } return frameType.getAnnotation(TypeValue.class).value(); }
@TypeValue(ApplicationArchiveModel.TYPE) public interface ApplicationArchiveModel extends ApplicationModel, ArchiveModel { String TYPE = "ApplicationArchiveModel"; }
public static boolean hasType(Class<? extends WindupVertexFrame> type, Vertex v) { TypeValue typeValueAnnotation = type.getAnnotation(TypeValue.class); if (typeValueAnnotation == null) { throw new IllegalArgumentException("Class " + type.getCanonicalName() + " lacks a @TypeValue annotation"); } // LOG.info("has type called for: " + type + " and vertex: " + v); Iterable<String> vertexTypes = getTypeProperties(v); for (String typeValue : vertexTypes) { if (typeValue.equals(typeValueAnnotation.value())) { return true; } } return false; }
@TypeValue(CssFileModel.TYPE) public interface CssFileModel extends FileModel, SourceFileModel { Logger LOG = Logger.getLogger(CssFileModel.class.getName()); String TYPE = "CssFile"; }
public static boolean hasType(Class<? extends WindupVertexFrame> type, Vertex v) { TypeValue typeValueAnnotation = type.getAnnotation(TypeValue.class); if (typeValueAnnotation == null) { throw new IllegalArgumentException("Class " + type.getCanonicalName() + " lacks a @TypeValue annotation"); } // LOG.info("has type called for: " + type + " and vertex: " + v); Iterable<String> vertexTypes = getTypeProperties(v); for (String typeValue : vertexTypes) { if (typeValue.equals(typeValueAnnotation.value())) { return true; } } return false; }
@TypeValue(JsFileModel.TYPE) public interface JsFileModel extends FileModel, SourceFileModel { Logger LOG = Logger.getLogger(JsFileModel.class.getName()); String TYPE = "JsFile"; }
private void addTypeToRegistry(Class<? extends WindupFrame<?>> frameType) { LOG.info(" Adding type to registry: " + frameType.getName()); TypeValue typeValueAnnotation = frameType.getAnnotation(TypeValue.class); // Do not attempt to add types without @TypeValue. We use // *Model types with no @TypeValue to function as essentially // "abstract" models that would never exist on their own (only as subclasses). if (typeValueAnnotation == null) { String msg = String.format("@%s is missing on type %s", TypeValue.class.getSimpleName(), frameType.getName()); LOG.warning(msg); return; } if (getRegisteredTypeMap().containsKey(typeValueAnnotation.value())) { throw new IllegalArgumentException("Type value for model '" + frameType.getCanonicalName() + "' is already registered with model " + getRegisteredTypeMap().get(typeValueAnnotation.value()).getName()); } getRegisteredTypeMap().put(typeValueAnnotation.value(), frameType); getTypeRegistry().add(frameType); }
/** * Represents a JSP file on disk. * * @author <a href="mailto:jesse.sightler@gmail.com">Jesse Sightler</a> */ @TypeValue(JspSourceFileModel.TYPE) public interface JspSourceFileModel extends AbstractJavaSourceModel { String TYPE = "JspSourceFileModel"; }
@Override public List<ModelTypeInformation> getTypes() { return this.graphTypeManager.getRegisteredTypes().stream() .map(type -> { TypeValue typeValueAnnotation = type.getAnnotation(TypeValue.class); if (typeValueAnnotation == null) return null; return new ModelTypeInformation(typeValueAnnotation.value(), type.getSimpleName()); }) .filter(Objects::nonNull) .sorted((type1, type2) -> type1.getClassName().compareToIgnoreCase(type2.getClassName())) .collect(Collectors.toList()); }
/** * Indicates that an Archive file can be ignored. * * @author <a href="mailto:ozizka@redhat.com">Ondrej Zizka</a> * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @TypeValue(IgnoredArchiveModel.TYPE) public interface IgnoredArchiveModel extends ArchiveModel, IgnoredFileModel { String TYPE = "IgnoredArchiveModel"; }
@TypeValue(JavaAnnotationTypeValueModel.TYPE) public interface JavaAnnotationTypeValueModel extends WindupVertexFrame { String TYPE = "JavaAnnotationTypeValueModel"; }
@TypeValue(JsFileModel.TYPE) public interface JsFileModel extends FileModel, SourceFileModel { Logger LOG = Logger.getLogger(JsFileModel.class.getName()); String TYPE = "JsFile"; }
/** * Represents a JSF template (either in jsp syntax or jsf syntax). * * @author <a href="mailto:jesse.sightler@gmail.com">Jesse Sightler</a> */ @TypeValue(JsfSourceFileModel.TYPE) public interface JsfSourceFileModel extends AbstractJavaSourceModel { String TYPE = "JsfSourceFile"; }
/** * Base type for Web Service. * * @author <a href="mailto:bradsdavis@gmail.com">Brad Davis</a> */ @TypeValue(WebServiceModel.TYPE) public interface WebServiceModel extends RemoteServiceModel { String TYPE = "WebServiceModel"; }
@TypeValue(ApplicationModel.TYPE) public interface ApplicationModel extends WindupVertexFrame { String TYPE = "ApplicationModel"; String PROPERTY_APPLICATION_NAME = "applicationName"; @Property(PROPERTY_APPLICATION_NAME) void setApplicationName(String name); @Property(PROPERTY_APPLICATION_NAME) String getApplicationName(); }
@TypeValue(AmbiguousJavaClassModel.TYPE) public interface AmbiguousJavaClassModel extends AmbiguousReferenceModel<JavaClassModel>, JavaClassModel { String TYPE = "AmbiguousJavaClassModel"; }