public TypeOracleMessageInterface(GwtLocaleFactory factory, JClassType type, ResourceList resources) { super(factory); this.type = type; this.oracle = type.getOracle(); this.resources = resources; }
public TypeOracleMessageInterface(GwtLocaleFactory factory, JClassType type, ResourceList resources) { super(factory); this.type = type; this.oracle = type.getOracle(); this.resources = resources; }
private static JClassType getIsSerializableMarkerInterface(JClassType type) throws NotFoundException { return type.getOracle().getType(IsSerializable.class.getName()); }
private static boolean isManuallySerializable(JClassType type) { return findCustomFieldSerializer(type.getOracle(), type) != null; }
private static JClassType getIsSerializableMarkerInterface(JClassType type) throws NotFoundException { return type.getOracle().getType(IsSerializable.class.getName()); }
private static JClassType getSerializableMarkerInterface(JClassType type) throws NotFoundException { return type.getOracle().getType(Serializable.class.getName()); }
private static JClassType getSerializableMarkerInterface(JClassType type) throws NotFoundException { return type.getOracle().getType(Serializable.class.getName()); }
private static boolean isManuallySerializable(JClassType type) { return findCustomFieldSerializer(type.getOracle(), type) != null; }
public void setKeyClazz(JClassType keyClazz) { if(OBJECT_TYPE == null){ OBJECT_TYPE = keyClazz.getOracle().findType(Object.class.getName()); } //Since the referenced type was already verified before, we use Object.class for all non primitive/non array types toReturn.keyClazz = isPrimitive(keyClazz) ? keyClazz : OBJECT_TYPE; }
public StorageKeyProviderModel(TreeLogger logger, JClassType providerType) { this.providerType = providerType; this.storageKeyGenericType = providerType.getOracle().findType(StorageKey.class.getCanonicalName()).isGenericType(); this.serializableIntf = providerType.getOracle().findType(Serializable.class.getCanonicalName()).isInterface(); this.isSerializableIntf = providerType.getOracle().findType(IsSerializable.class.getCanonicalName()).isInterface(); this.methods = new ArrayList<>(); this.logger = logger; }
private static boolean isEditor(JType type) { JClassType classType = type.isClassOrInterface(); if (classType == null) { return false; } TypeOracle oracle = classType.getOracle(); return oracle.findType(IsEditor.class.getName()).isAssignableFrom(classType); }
private static boolean isEditor(JType type) { JClassType classType = type.isClassOrInterface(); if (classType == null) { return false; } TypeOracle oracle = classType.getOracle(); return oracle.findType(IsEditor.class.getName()).isAssignableFrom(classType); }
/** * Returns {@code true} if the method matches {@code boolean isFoo()} or * {@code boolean hasFoo()} property accessors. */ private boolean isBooleanProperty(JMethod method) { JType returnType = method.getReturnType(); if (JPrimitiveType.BOOLEAN.equals(returnType) || method.getEnclosingType().getOracle().findType( Boolean.class.getCanonicalName()).equals(returnType)) { String name = method.getName(); if (name.startsWith(IS_PREFIX) && name.length() > 2) { return true; } if (name.startsWith(HAS_PREFIX) && name.length() > 3) { return true; } } return false; } },
/** * Returns {@code true} if the method matches {@code boolean isFoo()} or * {@code boolean hasFoo()} property accessors. */ private boolean isBooleanProperty(JMethod method) { JType returnType = method.getReturnType(); if (JPrimitiveType.BOOLEAN.equals(returnType) || method.getEnclosingType().getOracle().findType( Boolean.class.getCanonicalName()).equals(returnType)) { String name = method.getName(); if (name.startsWith(IS_PREFIX) && name.length() > 2) { return true; } if (name.startsWith(HAS_PREFIX) && name.length() > 3) { return true; } } return false; } },
/** * Given type assignable to <code>Editor<Foo></code>, return * <code>Foo</code>. It is an error to call this method with a type not * assignable to {@link Editor}. */ static JClassType calculateEditedType(TreeLogger logger, JClassType editorType) throws UnableToCompleteException { JClassType editorIntf = editorType.getOracle().findType( Editor.class.getName()); JClassType parameterization[] = ModelUtils.findParameterizationOf( editorIntf, editorType); if (parameterization != null) { return parameterization[0]; } logger.log(TreeLogger.ERROR, noEditorParameterizationMessage(editorIntf, editorType)); throw new UnableToCompleteException(); }
/** * Given type assignable to <code>IsEditor<Foo, FooEditor></code>, return * <code>FooEditor</code>. It is an error to call this method with a type not * assignable to {@link IsEditor}. */ static JClassType calculateIsEditedType(TreeLogger logger, JClassType editorType) throws UnableToCompleteException { JClassType editorIntf = editorType.getOracle().findType( IsEditor.class.getName()); JClassType[] parameterization = ModelUtils.findParameterizationOf( editorIntf, editorType); if (parameterization != null) { return parameterization[0]; } logger.log(TreeLogger.ERROR, noEditorParameterizationMessage(editorIntf, editorType)); throw new UnableToCompleteException(); }
/** * Given type assignable to <code>IsEditor<Foo, FooEditor></code>, return * <code>FooEditor</code>. It is an error to call this method with a type not * assignable to {@link IsEditor}. */ static JClassType calculateIsEditedType(TreeLogger logger, JClassType editorType) throws UnableToCompleteException { JClassType editorIntf = editorType.getOracle().findType( IsEditor.class.getName()); JClassType[] parameterization = ModelUtils.findParameterizationOf( editorIntf, editorType); if (parameterization != null) { return parameterization[0]; } logger.log(TreeLogger.ERROR, noEditorParameterizationMessage(editorIntf, editorType)); throw new UnableToCompleteException(); }
/** * Given type assignable to <code>Editor<Foo></code>, return * <code>Foo</code>. It is an error to call this method with a type not * assignable to {@link Editor}. */ static JClassType calculateEditedType(TreeLogger logger, JClassType editorType) throws UnableToCompleteException { JClassType editorIntf = editorType.getOracle().findType( Editor.class.getName()); JClassType parameterization[] = ModelUtils.findParameterizationOf( editorIntf, editorType); if (parameterization != null) { return parameterization[0]; } logger.log(TreeLogger.ERROR, noEditorParameterizationMessage(editorIntf, editorType)); throw new UnableToCompleteException(); }
private void createInnerBindedModelProxyInterface() throws NotFoundException { ModelBinder modelBinder = type.getAnnotation(ModelBinder.class); JClassType binderType = type.getOracle().getType(modelBinder.binder().getCanonicalName()); Binder binderAnnotation = binderType.getAnnotation(Binder.class); Clazz clazz = new Clazz(Visibility.PUBLIC, binderAnnotation.bindedModel().getSimpleName()+type.getSimpleSourceName()+"Proxy", true); clazz.addSuperClass(IBindedModelProxy.class); Annotation bindedModelProxyAnnotation = new Annotation(BindedModelProxy.class.getCanonicalName()); bindedModelProxyAnnotation.addParameter("type="+binderAnnotation.bindedModel().getCanonicalName()+".class"); clazz.addAnnotation(bindedModelProxyAnnotation); composerHelper.addInnerClass(clazz); constructor.getBody().append(String.format("this.bindedModelProxy = GWT.create(%s.class)", clazz.getName())); constructor.getBody().append("this.bindedModelProxy.setBindedModel(bindedModel)"); }
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; }