本文整理汇总了Java中com.google.gwt.core.ext.typeinfo.JField.isPublic方法的典型用法代码示例。如果您正苦于以下问题:Java JField.isPublic方法的具体用法?Java JField.isPublic怎么用?Java JField.isPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.core.ext.typeinfo.JField
的用法示例。
在下文中一共展示了JField.isPublic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFieldModifier
import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
private String getFieldModifier( JField field )
{
ModifierBuilder mb = new ModifierBuilder();
if( field.isPrivate() )
mb.append( "2" );//"java.lang.reflect.Modifier.PRIVATE" );
if( field.isProtected() )
mb.append( "4" );//"java.lang.reflect.Modifier.PROTECTED" );
if( field.isPublic() )
mb.append( "1" );//"java.lang.reflect.Modifier.PUBLIC" );
if( field.isStatic() )
mb.append( "8" );//"java.lang.reflect.Modifier.STATIC" );
if( field.isTransient() )
mb.append( "128" );//"java.lang.reflect.Modifier.TRANSIENT" );
if( field.isVolatile() )
mb.append( "64" );//"java.lang.reflect.Modifier.VOLATILE" );
if( field.isFinal() )
mb.append( "16" );//"java.lang.reflect.Modifier.FINAL" );
return mb.toString();
}
示例2: writeValidateFieldCall
import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
private void writeValidateFieldCall(final SourceWriter sw,
final PropertyDescriptor ppropertyDescription, final boolean useValue,
final boolean honorValid) {
final String propertyName = ppropertyDescription.getPropertyName();
// validateProperty_<<field>>(context,
sw.print(this.validateMethodFieldName(ppropertyDescription));
sw.print("(context, ");
sw.print("violations, ");
// null, (MyType) value,
// or
// object, object.getLastName(),
if (useValue) {
sw.print("null, ");
sw.print("(");
sw.print(this.getQualifiedSourceNonPrimitiveType(
this.beanHelper.getElementType(ppropertyDescription, true)));
sw.print(") value");
} else {
sw.print("object, ");
final JField field = this.beanType.getField(propertyName);
if (field.isPublic()) {
sw.print("object.");
sw.print(propertyName);
} else {
this.fieldsToWrap.add(field);
sw.print(this.toWrapperName(field) + "(object)");
}
}
sw.print(", ");
// honorValid, groups);
sw.print(Boolean.toString(honorValid));
sw.println(", groups);");
}
示例3: listPublicFields
import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
private void listPublicFields(JField[] fields) {
for (JField field : fields) {
if (field.isPublic() && !field.isFinal()) {
this.publicFields.put(field.getName(), field.getType());
this.propertyTypes.put(field.getName(), field.getType());
this.addImport(field.getType());
}
}
}
示例4: createImport
import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
/**
* Process <code><ui:import field="com.example.Blah.CONSTANT"></code>.
*/
private void createImport(XMLElement elem) throws UnableToCompleteException {
String rawFieldName = elem.consumeRequiredRawAttribute(FIELD_ATTRIBUTE);
if (elem.getAttributeCount() > 0) {
writer.die(elem, "Should only find attribute \"%s\"", FIELD_ATTRIBUTE);
}
int idx = rawFieldName.lastIndexOf('.');
if (idx < 1) {
writer.die(elem, "Attribute %s does not look like a static import "
+ "reference", FIELD_ATTRIBUTE);
}
String enclosingName = rawFieldName.substring(0, idx);
String constantName = rawFieldName.substring(idx + 1);
JClassType enclosingType = oracle.findType(enclosingName);
if (enclosingType == null) {
writer.die(elem, "Unable to locate type %s", enclosingName);
}
if ("*".equals(constantName)) {
for (JField field : enclosingType.getFields()) {
if (!field.isStatic()) {
continue;
} else if (field.isPublic()) {
// OK
} else if (field.isProtected() || field.isPrivate()) {
continue;
} else if (!enclosingType.getPackage().equals(
writer.getOwnerClass().getOwnerType().getPackage())) {
// package-protected in another package
continue;
}
createSingleImport(elem, enclosingType, enclosingName + "."
+ field.getName(), field.getName());
}
} else {
createSingleImport(elem, enclosingType, rawFieldName, constantName);
}
}
示例5: isFieldVisibleInJS
import com.google.gwt.core.ext.typeinfo.JField; //导入方法依赖的package包/类
/**
* Return weather a given field is visible in JS (JsInterop).
* It will be the case if it's public and it's class has the {@link JsType} annotation, or
* if it has the {@link JsProperty} annotation.
* @param field The field to check
* @return true if it is visible (JsInterop), false otherwise
*/
public static boolean isFieldVisibleInJS(JField field)
{
return (hasAnnotation(field.getEnclosingType(), JsType.class) && field.isPublic())
|| hasAnnotation(field, JsProperty.class);
}