/** * Constructs an EditorAccess for an IsEditor type. */ public static EditorAccess via(EditorAccess access, JClassType type) { return new EditorAccess(access.getPath(), type, access.getExpresson() + ".asEditor()"); }
/** * Constructs an EditorAccess for an IsEditor type. */ public static EditorAccess via(EditorAccess access, JClassType type) { return new EditorAccess(access.getPath(), type, access.getExpresson() + ".asEditor()"); }
public Builder access(EditorAccess access) throws UnableToCompleteException { this.access = access; data.declaredPath = access.getPath(); data.editorType = access.getEditorType(); data.editedType = EditorModel.calculateEditedType(logger, data.editorType); data.simpleExpression = access.getExpresson(); TypeOracle oracle = data.editorType.getOracle(); JClassType leafType = oracle.findType(LeafValueEditor.class.getName()); data.isLeaf = leafType.isAssignableFrom(data.editorType); JClassType composedType = oracle.findType(CompositeEditor.class.getName()); data.isCompositeEditor = composedType.isAssignableFrom(data.editorType); JClassType hasDelegateType = oracle.findType(HasEditorDelegate.class.getName()); JClassType hasEditorErrorsType = oracle.findType(HasEditorErrors.class.getName()); data.isDelegateRequired = hasDelegateType.isAssignableFrom(data.editorType) || hasEditorErrorsType.isAssignableFrom(data.editorType) || !ModelUtils.isValueType(oracle, data.editedType); JClassType valueAwareType = oracle.findType(ValueAwareEditor.class.getName()); data.isValueAware = valueAwareType.isAssignableFrom(data.editorType); return this; }
public Builder access(EditorAccess access) throws UnableToCompleteException { this.access = access; data.declaredPath = access.getPath(); data.editorType = access.getEditorType(); data.editedType = EditorModel.calculateEditedType(logger, data.editorType); data.simpleExpression = access.getExpresson(); TypeOracle oracle = data.editorType.getOracle(); JClassType leafType = oracle.findType(LeafValueEditor.class.getName()); data.isLeaf = leafType.isAssignableFrom(data.editorType); JClassType composedType = oracle.findType(CompositeEditor.class.getName()); data.isCompositeEditor = composedType.isAssignableFrom(data.editorType); JClassType hasDelegateType = oracle.findType(HasEditorDelegate.class.getName()); JClassType hasEditorErrorsType = oracle.findType(HasEditorErrors.class.getName()); data.isDelegateRequired = hasDelegateType.isAssignableFrom(data.editorType) || hasEditorErrorsType.isAssignableFrom(data.editorType) || !ModelUtils.isValueType(oracle, data.editedType); JClassType valueAwareType = oracle.findType(ValueAwareEditor.class.getName()); data.isValueAware = valueAwareType.isAssignableFrom(data.editorType); return this; }
public EditorData build() throws UnableToCompleteException { if (data == null) { throw new IllegalStateException(); } try { data.editorExpression = (parent == null ? "" : (parent.getExpression() + ".")) + access.getExpresson(); data.path = (parent == null ? "" : (parent.getPath() + ".")) + access.getPath(); if (data.isCompositeEditor) { TreeLogger compositeLogger = logger.branch(TreeLogger.DEBUG, "Examining composite editor at " + data.path); JClassType subEditorType = EditorModel.calculateCompositeTypes(data.editorType)[1]; data.composedData = new Builder(compositeLogger).access( EditorAccess.root(subEditorType)).parent(data).build(); } return data; } finally { data = null; } }
public EditorData build() throws UnableToCompleteException { if (data == null) { throw new IllegalStateException(); } try { data.editorExpression = (parent == null ? "" : (parent.getExpression() + ".")) + access.getExpresson(); data.path = (parent == null ? "" : (parent.getPath() + ".")) + access.getPath(); if (data.isCompositeEditor) { TreeLogger compositeLogger = logger.branch(TreeLogger.DEBUG, "Examining composite editor at " + data.path); JClassType subEditorType = EditorModel.calculateCompositeTypes(data.editorType)[1]; data.composedData = new Builder(compositeLogger).access( EditorAccess.root(subEditorType)).parent(data).build(); } return data; } finally { data = null; } }
private List<EditorData> createEditorData(EditorAccess access) throws UnableToCompleteException { TreeLogger subLogger = logger.branch(TreeLogger.DEBUG, "Examining " + access.toString()); List<EditorData> toReturn = new ArrayList<EditorData>(); // Are we looking at a view that implements IsEditor? if (access.isEditor()) { EditorAccess subAccess = EditorAccess.via(access, calculateIsEditedType(subLogger, access.getEditorType())); toReturn = createEditorData(subAccess); // If an object only implements IsEditor, return now if (!editorIntf.isAssignableFrom(access.getEditorType())) { return toReturn; } } // Determine the Foo in Editor<Foo> JClassType expectedToEdit = calculateEditedType(subLogger, access.getEditorType()); EditorData.Builder builder = new EditorData.Builder(subLogger); builder.access(access); builder.parent(editorSoFar); // Find the bean methods on the proxy interface findBeanPropertyMethods(access.getPath(), expectedToEdit, builder); toReturn.add(builder.build()); return toReturn; }
private List<EditorData> createEditorData(EditorAccess access) throws UnableToCompleteException { TreeLogger subLogger = logger.branch(TreeLogger.DEBUG, "Examining " + access.toString()); List<EditorData> toReturn = new ArrayList<EditorData>(); // Are we looking at a view that implements IsEditor? if (access.isEditor()) { EditorAccess subAccess = EditorAccess.via(access, calculateIsEditedType(subLogger, access.getEditorType())); toReturn = createEditorData(subAccess); // If an object only implements IsEditor, return now if (!editorIntf.isAssignableFrom(access.getEditorType())) { return toReturn; } } // Determine the Foo in Editor<Foo> JClassType expectedToEdit = calculateEditedType(subLogger, access.getEditorType()); EditorData.Builder builder = new EditorData.Builder(subLogger); builder.access(access); builder.parent(editorSoFar); // Find the bean methods on the proxy interface findBeanPropertyMethods(access.getPath(), expectedToEdit, builder); toReturn.add(builder.build()); return toReturn; }