public IType getOwnersType() { return _delegate.getOwnersType(); }
public IType getOwnersType() { return _delegate.getOwnersType(); }
@Override public List<IType> getFullArgTypes() { ArrayList<IType> lst = new ArrayList<IType>(); if (!_pi.isStatic()) { lst.add(_pi.getOwnersType()); } return lst; }
@Override public List<IType> getFullArgTypes() { ArrayList<IType> lst = new ArrayList<IType>(); if (!_pi.isStatic()) { lst.add(_pi.getOwnersType()); } return lst; }
private IPropertyInfo getDelegatedEnhancementProperty( IPropertyInfo pi ) { IPropertyInfo delegatePI = null; if( pi instanceof IPropertyInfoDelegate ) { delegatePI = ((IPropertyInfoDelegate) pi).getSource(); if( !isEnhancementType( delegatePI.getOwnersType() ) ) { delegatePI = null; } } return delegatePI; }
private boolean propertyInfosEqual( IPropertyInfo pi, IPropertyInfo findPi ) { if( pi == findPi ) { return true; } while( pi instanceof IPropertyInfoDelegate ) { pi = ((IPropertyInfoDelegate)pi).getSource(); } String name = pi.getName(); return name != null && name.equals( findPi.getName() ) && findPi.getOwnersType().isAssignableFrom( pi.getOwnersType() ); }
private IPropertyInfo getDelegatedEnhancementProperty( IPropertyInfo pi ) { IPropertyInfo delegatePI = null; if( pi instanceof IPropertyInfoDelegate ) { delegatePI = ((IPropertyInfoDelegate) pi).getSource(); if( !isEnhancementType( delegatePI.getOwnersType() ) ) { delegatePI = null; } } return delegatePI; }
protected static String deriveDescription(IPropertyInfo propertyInfo) { IType intrinsicType = propertyInfo.getOwnersType(); String description; try { ResourceBundle resourceBundle = ResourceBundle.getBundle( intrinsicType.getName(), Locale.getDefault(), TypeSystem.getGosuClassLoader().getActualLoader() ); description = resourceBundle.getString(propertyInfo.getName()); } catch (MissingResourceException e) { description = propertyInfo.getDescription(); } return description == null ? "" : description.replaceAll("\n", " "); }
private String getMemberHelp( IPropertyInfo propertyInfo ) { IType type = propertyInfo.getOwnersType(); if( isTypeHandled( type ) ) { return buildHtmlForProperty( (IJavaType)type, propertyInfo ); } else if( type instanceof IJavaType ) { return getGenericNoJavadocContent( propertyInfo ); } else { return null; } }
private String getMemberHelp( IPropertyInfo propertyInfo ) { IType type = propertyInfo.getOwnersType(); if( isTypeHandled( type ) ) { return buildHtmlForProperty( (IJavaType)type, propertyInfo ); } else if( type instanceof IJavaType ) { return getGenericNoJavadocContent( propertyInfo ); } else { return null; } }
private IPropertyInfo maybeGetProxiedPropertyInfo( String propName, IPropertyInfo pi ) { if( GosuClass.ProxyUtil.isProxy( pi.getOwnersType() ) ) { ITypeInfo ti = GosuClass.ProxyUtil.getProxiedType( pi.getOwnersType() ).getTypeInfo(); pi = ti instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)ti).getProperty( getGosuClass(), propName ) : ti.getProperty( propName ); } else if( pi instanceof IPropertyInfoDelegate ) { pi = maybeGetProxiedPropertyInfo( propName, ((IPropertyInfoDelegate)pi).getSource() ); } return pi; }
protected void mergeProperty(PropertyNameMap<T> props, IPropertyInfo propertyInfo, boolean replace) { boolean prependPrefix = _superPropertyPrefix != null && ! propertyInfo.getOwnersType().equals( _typeInfo.getOwnersType() ); T cs = convertCharSequenceToCorrectSensitivity( prependPrefix ? ( _superPropertyPrefix + propertyInfo.getName() ) : propertyInfo.getName() ); if ( replace || shouldReplace( props, cs, propertyInfo ) ) { if ( prependPrefix ) { props.put( cs, new PropertyInfoDelegate( propertyInfo.getContainer(), propertyInfo, cs.toString() ) ); } else { props.put(cs, propertyInfo); } } }
protected void mergeProperty(PropertyNameMap<T> props, IPropertyInfo propertyInfo, boolean replace) { boolean prependPrefix = _superPropertyPrefix != null && ! propertyInfo.getOwnersType().equals( _typeInfo.getOwnersType() ); T cs = convertCharSequenceToCorrectSensitivity( prependPrefix ? ( _superPropertyPrefix + propertyInfo.getName() ) : propertyInfo.getName() ); if (replace || !props.containsKey(cs)) { if ( prependPrefix ) { props.put( cs, new PropertyInfoDelegate( propertyInfo.getContainer(), propertyInfo, cs.toString() ) ); } else { props.put(cs, propertyInfo); } } }
private IRStatement assignStaticMember( IPropertyInfo pi, IRProperty irProperty, IRType propertyType ) { // Unwrap the property, and use the real owner's type as the type to compile against while( pi instanceof IPropertyInfoDelegate ) { pi = ((IPropertyInfoDelegate)pi).getSource(); } IType rootType = pi.getOwnersType(); if( irProperty.isBytecodeProperty() ) { IRExpression rhs = compileRhs( irProperty ); if( irProperty.isField() ) { return setStaticField( rootType, getField( pi ), propertyType, AccessibilityUtil.forFeatureInfo( pi ), rhs ); } else { return buildMethodCall( callMethod( irProperty.getSetterMethod(), null, exprList( rhs ) ) ); } } else { return reflectivelySetProperty( pi.getOwnersType(), pushConstant( pi.getDisplayName() ), nullLiteral(), false ); } }
protected void mergeProperties(PropertyNameMap<T> props, IType type, boolean replace) { if( type != null ) { List<? extends IPropertyInfo> propertyInfos; if (type.getTypeInfo() instanceof IRelativeTypeInfo) { propertyInfos = ((IRelativeTypeInfo) type.getTypeInfo()).getProperties( _typeInfo.getOwnersType()); } else { propertyInfos = type.getTypeInfo().getProperties(); } for (IPropertyInfo propertyInfo : propertyInfos) { IType ownersType = propertyInfo.getOwnersType(); if ( _supertypeToCopyPropertiesFrom == null || ownersType.isAssignableFrom( _supertypeToCopyPropertiesFrom ) || ownersType instanceof IGosuEnhancement ) { mergeProperty( props, propertyInfo, replace ); } } } }
protected void mergeProperties(PropertyNameMap<T> props, IType type, boolean replace) { if( type != null ) { List<? extends IPropertyInfo> propertyInfos; if (type.getTypeInfo() instanceof IRelativeTypeInfo) { propertyInfos = ((IRelativeTypeInfo) type.getTypeInfo()).getProperties( _typeInfo.getOwnersType()); } else { propertyInfos = type.getTypeInfo().getProperties(); } for (IPropertyInfo propertyInfo : propertyInfos) { IType ownersType = propertyInfo.getOwnersType(); if ( _supertypeToCopyPropertiesFrom == null || ownersType.isAssignableFrom( _supertypeToCopyPropertiesFrom ) || ownersType instanceof IGosuEnhancement ) { mergeProperty( props, propertyInfo, replace ); } } } }
private IRExpression autoCreateEntityValue(IPropertyInfo pi, IRSymbol rootSymbol) { return checkCast( _expr().getType(), callStaticMethod(MemberAccessTransformer.class, "autoCreateEntityInstance", new Class[]{Object.class, String.class, String.class}, exprList( identifier( rootSymbol ), pushConstant(pi.getOwnersType().getName()), pushConstant(pi.getName())) ) ); }
private IRExpression autoCreateEntityValue(IPropertyInfo pi, IRSymbol rootSymbol) { return checkCast( _expr().getType(), callStaticMethod(MemberAccessTransformer.class, "autoCreateEntityInstance", new Class[]{Object.class, String.class, String.class}, exprList( identifier( rootSymbol ), pushConstant(pi.getOwnersType().getName()), pushConstant(pi.getName())) ) ); }
private boolean areSymbolsFromSameDeclaration(IVarStatement varStmt, ISymbol existingSymbol) { boolean sameDeclaringType = GosuObjectUtil.equals(existingSymbol.getScriptPart(), varStmt.getSymbol().getScriptPart()); if( sameDeclaringType ) { return true; } if( existingSymbol.getScriptPart() != null ) { IGosuClassInternal existingDeclaringType = (IGosuClassInternal)existingSymbol.getScriptPart().getContainingType(); if( isProxy() && existingDeclaringType.isProxy() ) { // This class is a Java proxy and so is the declaring class of the existing symbol. In this case we need to get // the JavaType corresponding with this class' proxy and find where the existing symbol comes from within the Java // hierarchy. IPropertyInfo pi = ((IRelativeTypeInfo)getJavaType().getTypeInfo()).getProperty( getTheRef(), existingSymbol.getName() ); return pi != null && pi.getOwnersType() == existingDeclaringType.getJavaType(); } } return false; }
private void checkMemberAccessIsReadable() { Expression expr = peekExpression(); if( expr instanceof MemberAccess ) { IPropertyInfo pi = ((MemberAccess)expr).getPropertyInfoWithoutThrowing(); if( pi != null ) { verify( expr, pi.isReadable( getGosuClass() ), Res.MSG_CLASS_PROPERTY_NOT_READABLE, pi.getName(), pi.getOwnersType().getName() ); } } else if( (expr instanceof Identifier && ((Identifier)expr).getSymbol() instanceof DynamicPropertySymbol) ) { DynamicPropertySymbol dps = (DynamicPropertySymbol)((Identifier)expr).getSymbol(); if( dps != null && dps.getPropertyInfo() != null && !dps.getPropertyInfo().isReadable( getGosuClass() ) ) { verify( expr, false, Res.MSG_CLASS_PROPERTY_NOT_READABLE, dps.getName(), dps.getScriptPart() == null ? "" : dps.getScriptPart().getContainingType().getName() ); } } }