当前位置: 首页>>代码示例>>Java>>正文


Java FieldOutline.parent方法代码示例

本文整理汇总了Java中com.sun.tools.xjc.outline.FieldOutline.parent方法的典型用法代码示例。如果您正苦于以下问题:Java FieldOutline.parent方法的具体用法?Java FieldOutline.parent怎么用?Java FieldOutline.parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.xjc.outline.FieldOutline的用法示例。


在下文中一共展示了FieldOutline.parent方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getter

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public static JMethod getter(FieldOutline fieldOutline) {
	final JDefinedClass theClass = fieldOutline.parent().implClass;
	final String publicName = fieldOutline.getPropertyInfo().getName(true);
	final JMethod getgetter = theClass.getMethod("get" + publicName, NONE);
	if (getgetter != null) {
		return getgetter;
	} else {
		final JMethod isgetter = theClass
				.getMethod("is" + publicName, NONE);
		if (isgetter != null) {
			return isgetter;
		} else {
			return null;
		}
	}
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:17,代码来源:FieldAccessorUtils.java

示例2: getPossibleTypes

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public static Set<JType> getPossibleTypes(FieldOutline fieldOutline,
		Aspect aspect) {
	Validate.notNull(fieldOutline);
	final ClassOutline classOutline = fieldOutline.parent();
	final Outline outline = classOutline.parent();
	final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();

	final Set<JType> types = new HashSet<JType>();

	if (propertyInfo.getAdapter() != null) {
		types.add(propertyInfo.getAdapter().customType.toType(fieldOutline
				.parent().parent(), aspect));
	} else if (propertyInfo.baseType != null) {
		types.add(propertyInfo.baseType);
	} else {
		Collection<? extends CTypeInfo> typeInfos = propertyInfo.ref();
		for (CTypeInfo typeInfo : typeInfos) {
			types.addAll(getPossibleTypes(outline, aspect, typeInfo));
		}
	}
	return types;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:23,代码来源:FieldUtils.java

示例3: getter

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
/**
 * Borrowed this code from jaxb-commons project
 *
 * @param fieldOutline reference to a field
 * @return Getter for the given field or null
 */
static JMethod getter(FieldOutline fieldOutline) {
    final JDefinedClass theClass = fieldOutline.parent().implClass;
    final String publicName = fieldOutline.getPropertyInfo().getName(true);
    final JMethod getgetter = theClass.getMethod("get" + publicName, NONE);
    if (getgetter != null) {
        return getgetter;
    } else {
        final JMethod isgetter = theClass
                .getMethod("is" + publicName, NONE);
        if (isgetter != null) {
            return isgetter;
        } else {
            return null;
        }
    }
}
 
开发者ID:massfords,项目名称:jaxb-visitor,代码行数:23,代码来源:ClassDiscoverer.java

示例4: setter

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
/**
 * Returns the <code>setProperty(...)</code> method for the given field
 * outline or <code>null</code> if no such method exists.
 * 
 * @param fieldOutline
 *            field outline.
 * @return The <code>setProperty(...)</code> method for the given field
 *         outline or <code>null</code> if no such method exists.
 */
public static JMethod setter(FieldOutline fieldOutline) {

	final JMethod getter = getter(fieldOutline);
	final JType type = getter != null ? getter.type() : fieldOutline
			.getRawType();
	final JDefinedClass theClass = fieldOutline.parent().implClass;
	final String publicName = fieldOutline.getPropertyInfo().getName(true);
	final String name = "set" + publicName;
	return theClass.getMethod(name, new JType[] { type });
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:20,代码来源:FieldAccessorUtils.java

示例5: findGetter

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public static JMethod findGetter(final FieldOutline field) {
	final ClassOutline classOutline = field.parent();
	String propertyName = field.getPropertyInfo().getName(true);
	if ("Any".equals(propertyName)) {
		propertyName = "Content";
	}
	String getterName = "get" + propertyName;
	JMethod m = classOutline.implClass.getMethod(getterName, new JType[0]);
	if (m == null) {
		getterName = "is" + propertyName;
		m = classOutline.implClass.getMethod(getterName, new JType[0]);
	}
	return m;
}
 
开发者ID:mklemm,项目名称:jaxb2-rich-contract-plugin,代码行数:15,代码来源:PluginContext.java

示例6: findSetter

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public static JMethod findSetter(final FieldOutline field) {
	final ClassOutline classOutline = field.parent();
	String propertyName = field.getPropertyInfo().getName(true);
	if ("Any".equals(propertyName)) {
		propertyName = "Content";
	}
	final String setterName = "set" + propertyName;
	for (final JMethod method : classOutline.implClass.methods()) {
		if (method.name().equals(setterName) && method.listParams().length == 1) {
			return method;
		}
	}
	return null;
}
 
开发者ID:mklemm,项目名称:jaxb2-rich-contract-plugin,代码行数:15,代码来源:PluginContext.java

示例7: PropertyFieldAccessor

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public PropertyFieldAccessor(final FieldOutline fieldOutline,
		JExpression targetObject) {
	super();
	this.fieldOutline = fieldOutline;
	this.targetObject = targetObject;
	this.fieldAccessor = fieldOutline.create(targetObject);
	final String publicName = fieldOutline.getPropertyInfo().getName(
			true);
	final String privateName = fieldOutline.getPropertyInfo().getName(
			false);
	this.theClass = fieldOutline.parent().implClass;
	final String setterName = "set" + publicName;
	final JMethod getGetter = theClass.getMethod("get" + publicName,
			ABSENT);
	final JMethod isGetter = theClass.getMethod("is" + publicName,
			ABSENT);
	final JFieldVar field = theClass.fields().get(privateName);
	this.field = field != null
			&& ((field.mods().getValue() & JMod.PROTECTED) != 0)
			&& ((field.mods().getValue() & JMod.STATIC) == 0)
			&& ((field.mods().getValue() & JMod.FINAL) == 0) ? field
			: null;
	this.getter = getGetter != null ? getGetter
			: (isGetter != null ? isGetter : null);
	this.type = this.getter != null ? this.getter.type() : fieldOutline
			.getRawType();
	this.fieldType = this.field != null ? this.field.type() : this.type;

	final JFieldVar constantField = theClass.fields().get(publicName);
	this.constantField = constantField != null
			&& ((constantField.mods().getValue() & JMod.PUBLIC) != 0)
			&& ((constantField.mods().getValue() & JMod.STATIC) != 0)
			&& ((constantField.mods().getValue() & JMod.FINAL) != 0) ? constantField
			: null;
	// fieldOutline.getRawType();
	final JType rawType = fieldOutline.getRawType();
	final JMethod boxifiedSetter = theClass.getMethod(setterName,
			new JType[] { rawType.boxify() });
	final JMethod unboxifiedSetter = theClass.getMethod(setterName,
			new JType[] { rawType.unboxify() });
	this.setter = boxifiedSetter != null ? boxifiedSetter
			: unboxifiedSetter;
	this.isSetter = theClass.getMethod("isSet" + publicName, ABSENT);
	this.unSetter = theClass.getMethod("unset" + publicName, ABSENT);
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:46,代码来源:PropertyFieldAccessorFactory.java

示例8: issetter

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
/**
 * Returns the <code>isSetProperty()</code> method for the given field
 * outline or <code>null</code> if no such method exists.
 * 
 * @param fieldOutline
 *            field outline.
 * @return The <code>isSetProperty()</code> method for the given field
 *         outline or <code>null</code> if no such method exists.
 */
public static JMethod issetter(FieldOutline fieldOutline) {
	final JDefinedClass theClass = fieldOutline.parent().implClass;
	final String publicName = fieldOutline.getPropertyInfo().getName(true);
	final String name = "isSet" + publicName;
	return theClass.getMethod(name, NONE);
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:16,代码来源:FieldAccessorUtils.java

示例9: getSourceIdFieldsOutline

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
public Collection<FieldOutline> getSourceIdFieldsOutline(Mapping context,
		FieldOutline fieldOutline) {

	final ClassOutline classOutline = fieldOutline.parent();

	return getIdFieldsOutline(classOutline);
}
 
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:8,代码来源:DefaultAssociationMapping.java

示例10: field

import com.sun.tools.xjc.outline.FieldOutline; //导入方法依赖的package包/类
/**
 * Returns the field for the given field outline or <code>null</code> if no
 * such field exists.
 * 
 * @param fieldOutline
 *            field outline.
 * @return The field for the given field outline or <code>null</code> if no
 *         such field exists.
 */
public static JFieldVar field(FieldOutline fieldOutline) {
	final JDefinedClass theClass = fieldOutline.parent().implClass;
	return theClass.fields().get(
			fieldOutline.getPropertyInfo().getName(false));
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:15,代码来源:FieldAccessorUtils.java


注:本文中的com.sun.tools.xjc.outline.FieldOutline.parent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。