private void genInterfacePropertyDecl(StringBuilder sb, IPropertyInfo pi, IJavaType javaType) { if (pi.isStatic()) { genStaticProperty(pi, sb, javaType); return; } if (!pi.isReadable()) { return; } if (!(pi instanceof JavaBaseFeatureInfo)) { // It is possible that a methodinfo on a java type originates outside of java. // E.g., enhancement methods. Gosu does not support extending these. return; } IType type = getGenericType(pi); if (pi.getDescription() != null) { sb.append("/** ").append(pi.getDescription()).append(" */"); } sb.append(" property get ") .append(pi.getName()) .append("() : ") .append(type.getName()) .append("\n"); if (pi.isWritable(pi.getOwnersType())) { sb.append(" property set ") .append(pi.getName()) .append("( _proxy_arg_value : ") .append(type.getName()) .append(" )\n"); } }
private boolean isPropertySetter(IMethodInfo mi) { String strMethod = mi.getDisplayName(); if (strMethod.startsWith("set") && strMethod.length() > 3 && mi.getParameters().length == 1 && mi.getReturnType() == JavaTypes.pVOID()) { String strProp = strMethod.substring("set".length()); if (Character.isUpperCase(strProp.charAt(0))) { ITypeInfo ti = (ITypeInfo) mi.getContainer(); IPropertyInfo pi = ti instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo) ti).getProperty(mi.getOwnersType(), strProp) : ti.getProperty(strProp); if (pi != null && pi.isReadable() && getGenericType(pi) .getName() .equals(getGenericParameters(mi)[0].getFeatureType().getName())) { return !Keyword.isReserved(pi.getName()) || Keyword.isReservedValue(pi.getName()); } } } return false; }