public ScriptPartId( IType type, String strPartId ) { _type = type; _typeName = type == null ? null : type.getName(); _strPartId = strPartId; }
default String getJavaName() { IType type = TypeSystem.getPureGenericType( this ); IType outerType = type.getEnclosingType(); if( outerType instanceof IFileRepositoryBasedType ) { return ((IFileRepositoryBasedType)outerType).getJavaName() + "$" + type.getRelativeName(); } return type.getName(); } }
/** */ public boolean isAssignableFrom( IType type ) { return type.getAllTypesInHierarchy().contains( getThisRef() ) || (type.isArray() && type.getClass().isInstance( getThisRef() ) && this.getComponentType().isAssignableFrom( type.getComponentType() )); }
@Override public boolean isAssignableFrom( IType type ) { if( type == this ) { return true; } return type.isArray() && !type.getComponentType().isPrimitive(); } }
@Override public boolean isAssignableFrom( IType type ) { if( type == this ) { return true; } return type.isArray() && getComponentType().isAssignableFrom( type.getComponentType() ); } }
public static IModule getModule(IType type) { IModule module = null; while (module == null && type != null) { if (type.getTypeLoader() == null) { type = type.getEnclosingType(); } else { module = type.getTypeLoader().getModule(); } } return module; }
static IMethodInfo getMethodInfo( IType rootType, String funcName, IType[] params ) { ITypeInfo typeInfo = rootType.getTypeInfo(); if( typeInfo instanceof IRelativeTypeInfo ) { return ((IRelativeTypeInfo)typeInfo).getMethod( rootType, funcName, params ); } else { return typeInfo.getMethod( funcName, params ); } }
private boolean isValidAnnotationMethodReturnType( IType returnType ) { return (returnType.isPrimitive() && returnType != JavaTypes.pVOID()) || returnType == JavaTypes.STRING() || returnType.getGenericType() == JavaTypes.CLASS() || JavaTypes.ANNOTATION().isAssignableFrom( returnType ) || returnType.isEnum() || (returnType.isArray() && isValidAnnotationMethodReturnType( returnType.getComponentType())); }
public String getNameWithBounds( boolean bRelative ) { return _boundingType == JavaTypes.OBJECT() ? getName() : (getName() + " " + Keyword.KW_extends + " " + (bRelative ? _boundingType.getRelativeName() : _boundingType.getName())); }
public IDefaultArrayType getThisRef() { IType compType = this; do { compType = compType.getComponentType(); } while( compType.isArray() ); return compType instanceof INonLoadableType || compType instanceof IJavaType ? this : (IDefaultArrayType)TypeSystem.getOrCreateTypeReference( this ); }
private String getTypeDisplayText( IType type ) { String strType; if( type.isArray() ) { strType = "List: " + getTypeDisplayText( type.getComponentType() ); } else { strType = type.getRelativeName(); } return strType; }
private IType getMoreSpecificType(IType type1, IType type2) { if (type1.isAssignableFrom(type2)) { return type2; } else if (type2.isAssignableFrom(type1)){ return type1; } else { return type1; } }
private IType getComponentType(IType partType) { if ( partType.isArray()) { return getComponentType(partType.getComponentType()); } if ( JavaTypes.LIST().isAssignableFrom( partType )) { IType[] parameters = partType.getTypeParameters(); return parameters.length != 1 ? partType : getComponentType(parameters[0]); } return partType; }
@Override public boolean isEntityClass(IType type) { if (type.isArray()) { return isEntityClass(type.getComponentType()); } else { String namespace = type.getNamespace(); //TODO-dp simplify this return "entity".equals(namespace); } }
/** This will unmarshal the element, provided it is exportable * * @param el the element to unmarshal * @param type the expected type * @return the value */ public static Object unmarshal(XmlElement el, IType type) { if (!type.getTypeInfo().hasAnnotation(ExportableMarshalInfo._exportAnnoType.get())) { throw new IllegalArgumentException(type.getRelativeName() + " is not exportable"); } return gw.internal.xml.config.XmlServices.unmarshal(type, el, new UnmarshalContext(null)); }
public static String getTypeName( IType type ) { return type.getRelativeName(); } }
public static XmlSchemaIndex<?> getSchemaIndexByType( IType type ) { for ( XmlSchemaResourceTypeLoaderBase typeLoader : type.getTypeLoader().getModule().getTypeLoaders( XmlSchemaResourceTypeLoaderBase.class ) ) { XmlSchemaIndex<?> schemaIndex = typeLoader.getSchemaForType( type.getName() ); if ( schemaIndex != null ) { return schemaIndex; } } return null; }
@Override public ITypeLoader getTypeLoader() { return _type.getTypeLoader(); }
public ArrayMarshalInfo( IType componentType, MarshalInfo componentMarshalInfo, boolean isComponent ) { super( componentType.getArrayType() ); _componentType = componentType; _componentMarshalInfo = componentMarshalInfo; _isComponent = isComponent; }
public IType getReturnType() { IType type = _delegate.getReturnType(); if( type.isArray() || type == JavaTypes.pVOID() ) { return type; } return type.getArrayType(); }