• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.tools.xjc.model.nav.NClass的典型用法代码示例。如果您正苦于以下问题:Java NClass类的具体用法?Java NClass怎么用?Java NClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NClass类属于com.sun.tools.xjc.model.nav包,在下文中一共展示了NClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: run

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
@Override
public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) throws Exception {
    PluginImpl clonePlugin = new PluginImpl();
    clonePlugin.run(outline, opt, errorHandler);

    Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
    for (Map.Entry<NClass, CClassInfo> entry : set) {
        ClassOutline classOutline = outline.getClazz(entry.getValue());
        if (isPrism(classOutline)) {
            removeConstructors(classOutline);
            removeCloneableMethod(classOutline);

            removePrivateStaticCopyMethods(classOutline);
            createCloneMethod(classOutline);
        }
    }

    return true;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:CloneProcessor.java


示例2: removeCustomGeneratedMethod

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
/**
 * remove generated equals methods from classes which extends from prism containers/objects
 */
private void removeCustomGeneratedMethod(Outline outline) {
    Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
    for (Map.Entry<NClass, CClassInfo> entry : set) {
        ClassOutline classOutline = outline.getClazz(entry.getValue());
        QName qname = getCClassInfoQName(entry.getValue());
        if (qname == null || (!hasParentAnnotation(classOutline, A_PRISM_OBJECT)
                && !hasParentAnnotation(classOutline, A_PRISM_CONTAINER))) {
            continue;
        }

        JDefinedClass definedClass = classOutline.implClass;
        Iterator<JClass> iterator = definedClass._implements();
        while (iterator.hasNext()) {
            JClass clazz = iterator.next();
            if (clazz.equals(CLASS_MAP.get(Equals.class)) || clazz.equals(CLASS_MAP.get(HashCode.class))) {
                iterator.remove();
            }
        }

        boolean isMidpointContainer = hasParentAnnotation(classOutline, A_PRISM_OBJECT);
        removeOldCustomGeneratedEquals(classOutline, isMidpointContainer);
        removeOldCustomGenerated(classOutline, isMidpointContainer, METHOD_HASH_CODE);
        removeOldCustomGenerated(classOutline, isMidpointContainer, METHOD_TO_STRING);
    }
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:29,代码来源:SchemaProcessor.java


示例3: addComplextType

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
private void addComplextType(Outline outline, Map<String, JFieldVar> namespaceFields) {
    Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
    for (Map.Entry<NClass, CClassInfo> entry : set) {
        ClassOutline classOutline = outline.getClazz(entry.getValue());
        QName qname = entry.getValue().getTypeName();
        if (qname == null) {
            continue;
        }

        JFieldVar var = namespaceFields.get(qname.getNamespaceURI());
        if (var != null) {
            createQNameDefinition(outline, classOutline.implClass, COMPLEX_TYPE_FIELD_NAME, var, qname);
        } else {
            createPSFField(outline, classOutline.implClass, COMPLEX_TYPE_FIELD_NAME, qname);
        }
    }
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:18,代码来源:SchemaProcessor.java


示例4: writeProgram

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
@Override
public void writeProgram(Module<NType, NClass> module, JSProgram program,
		Output output) {
	try {
		final JPackage _package = codeModel._package(output
				.getOutputPackageName());
		_package.addResourceFile(createTextFile(output.getFileName(),
				program));
	} catch (IOException ioex) {
		try {
			errorHandler.error(new SAXParseException(MessageFormat.format(
					"Could not create the code for the module [{0}].",
					module.getName()), null, ioex));
		} catch (SAXException ignored) {

		}
	}
}
 
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:19,代码来源:CodeModelProgramWriter.java


示例5: loadModel

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public MModelInfo<NType, NClass> loadModel(String resource)
		throws Exception {
	System.setProperty("javax.xml.accessExternalSchema", "all");

	new File("target/generated-sources/" + resource).mkdirs();
	final String[] arguments = new String[] { "-xmlschema",
			getClass().getResource("/" + resource).toExternalForm(), "-d",
			"target/generated-sources/" + resource, "-extension",
			"-Xjsonix", "-Xjsonix-generateJsonSchema" };

	Options options = new Options();
	options.parseArguments(arguments);
	ConsoleErrorReporter receiver = new ConsoleErrorReporter();
	Model model = ModelLoader.load(options, new JCodeModel(), receiver);
	model.generateCode(options, receiver);
	com.sun.codemodel.CodeWriter cw = options.createCodeWriter();
	model.codeModel.build(cw);

	final MModelInfo<NType, NClass> modelInfo = new XJCCMInfoFactory(model)
			.createModel();

	return modelInfo;
}
 
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:24,代码来源:MModelInfoLoader.java


示例6: AbstractPropertyOutline

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public AbstractPropertyOutline(Outline outline, MClassOutline classOutline,
		MPropertyInfo<NType, NClass> target) {
	Validate.notNull(outline);
	Validate.notNull(classOutline);
	Validate.notNull(target);
	this.outline = outline;
	this.modelOutline = classOutline.getParent();
	this.classOutline = classOutline;
	this.propertyInfo = target;
	this.codeModel = classOutline.getParent().getCode();

	this.referenceClass = classOutline.getReferenceCode();
	this.implementationClass = classOutline.getImplementationCode();
	this.implementationReferenceClass = classOutline
			.getImplementationReferenceCode();

	this.type = generateType();
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:19,代码来源:AbstractPropertyOutline.java


示例7: visitAttributePropertyInfo

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public Void visitAttributePropertyInfo(
		MAttributePropertyInfo<NType, NClass> info) {

	JAnnotationUse annotation = this.annotatable
			.annotate(XmlAttribute.class);

	final String name = info.getAttributeName().getLocalPart();
	final String namespace = info.getAttributeName().getNamespaceURI();

	annotation.param("name", name);

	// generate namespace property?
	if (!namespace.equals("")) { // assume attributeFormDefault ==
									// unqualified
		annotation.param("namespace", namespace);
	}

	// TODO
	// if(info.isRequired()) {
	// xaw.required(true);
	// }

	return null;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:25,代码来源:AnnotatePropertyVisitor.java


示例8: writeJsonStructure

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
@Override
public void writeJsonStructure(Module<NType, NClass> module,
		JsonStructure structure, String fileName) {
	try {
		final JPackage _package = codeModel._package("");
		_package.addResourceFile(createTextFile(fileName, structure));
	} catch (IOException ioex) {
		try {
			errorHandler.error(new SAXParseException(MessageFormat.format(
					"Could not create the code for the module [{0}].",
					module.getName()), null, ioex));
		} catch (SAXException ignored) {

		}
	}
}
 
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:17,代码来源:CodeModelJsonStructureWriter.java


示例9: CMClassOutline

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public CMClassOutline(MModelOutline parent, MPackageOutline packageOutline,
		MClassInfo<NType, NClass> target, MClassOutline superClassOutline,
		JDefinedClass referenceCode, JDefinedClass implementationCode,
		JClass implementationReferenceCode) {
	Validate.notNull(parent);
	Validate.notNull(packageOutline);
	Validate.notNull(target);
	Validate.notNull(referenceCode);
	Validate.notNull(implementationCode);
	Validate.notNull(implementationReferenceCode);
	this.parent = parent;
	this.packageOutline = packageOutline;
	this.target = target;
	this.superClassOutline = superClassOutline;
	this.referenceCode = referenceCode;
	this.implementationCode = implementationCode;
	this.implementationReferenceCode = implementationReferenceCode;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:19,代码来源:CMClassOutline.java


示例10: generate

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public MEnumOutline generate(MPackageOutline parent,
		MModelInfo<NType, NClass> modelInfo,
		MEnumLeafInfo<NType, NClass> enumLeafInfo) {
	final EnumOutline eo = outline.getEnum(this.enumLeafInfo);

	final CMEnumOutline enumOutline = new CMEnumOutline(parent.getParent(),
			parent, enumLeafInfo, eo.clazz);

	for (MEnumConstantInfo<NType, NClass> enumConstantInfo : enumLeafInfo
			.getConstants()) {

		if (enumConstantInfo.getOrigin() instanceof EnumConstantOutlineGeneratorFactory) {
			final MEnumConstantOutlineGenerator generator = ((EnumConstantOutlineGeneratorFactory) enumConstantInfo
					.getOrigin()).createGenerator(outline);
			final MEnumConstantOutline enumConstantOutline = generator
					.generate(enumOutline, modelInfo, enumConstantInfo);
			if (enumConstantOutline != null) {
				enumOutline.addEnumConstantOutline(enumConstantOutline);
			}
		}
	}
	return enumOutline;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:24,代码来源:CMEnumOutlineGenerator.java


示例11: generate

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public MEnumConstantOutline generate(MEnumOutline parent,
		MModelInfo<NType, NClass> modelInfo,
		MEnumConstantInfo<NType, NClass> enumConstantInfo) {

	final CEnumLeafInfo eli = enumConstant.getEnclosingClass();

	final EnumOutline enumOutline = outline.getEnum(eli);

	for (EnumConstantOutline enumConstantOutline : enumOutline.constants) {
		if (enumConstantOutline.target == enumConstant) {
			return new CMEnumConstantOutline(parent, enumConstantInfo,
					enumConstantOutline.constRef);
		}
	}
	return null;
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:17,代码来源:CMEnumConstantOutlineGenerator.java


示例12: generateElementOutline

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
private void generateElementOutline(CMModelOutline modelOutline,
		MModelInfo<NType, NClass> modelInfo,
		MElementInfo<NType, NClass> elementInfo)

{
	if (elementInfo.getOrigin() instanceof ElementOutlineGeneratorFactory) {
		final MElementOutlineGenerator generator = ((ElementOutlineGeneratorFactory) elementInfo
				.getOrigin()).createGenerator(outline);
		final MElementOutline elementOutline = generator
				.generate(modelOutline.getPackageOutline(elementInfo
						.getPackageInfo()), modelInfo, elementInfo);
		if (elementOutline != null) {
			modelOutline.addElementOutline(elementOutline);
		}
	}
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:17,代码来源:CMModelOutlineGenerator.java


示例13: generateEnumOutline

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
private void generateEnumOutline(CMModelOutline modelOutline,
		MModelInfo<NType, NClass> modelInfo,
		MEnumLeafInfo<NType, NClass> enumLeafInfo)

{
	if (enumLeafInfo.getOrigin() instanceof EnumOutlineGeneratorFactory) {
		final MEnumOutlineGenerator generator = ((EnumOutlineGeneratorFactory) enumLeafInfo
				.getOrigin()).createGenerator(outline);
		final MEnumOutline enumOutline = generator.generate(modelOutline
				.getPackageOutline(enumLeafInfo.getPackageInfo()),
				modelInfo, enumLeafInfo);
		if (enumOutline != null) {
			modelOutline.addEnumOutline(enumOutline);
		}
	}
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:17,代码来源:CMModelOutlineGenerator.java


示例14: run

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
@Override
public boolean run(Outline outline, Options opt,
		final ErrorHandler errorHandler) throws SAXException {

	final Model model = outline.getModel();
	final JCodeModel codeModel = outline.getCodeModel();

	final ProgramWriter<NType, NClass> programWriter = new CodeModelProgramWriter(
			codeModel, errorHandler);

	final JsonStructureWriter<NType, NClass> jsonStructureWriter = new CodeModelJsonStructureWriter(
			codeModel, errorHandler);

	new JsonixInvoker().execute(getSettings(), model, programWriter,
			jsonStructureWriter);

	return true;
}
 
开发者ID:highsource,项目名称:jsonix-schema-compiler,代码行数:19,代码来源:JsonixPlugin.java


示例15: getClazz

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
protected NClass getClazz(final String className) {
	return new NClass() {

		@Override
		public boolean isBoxedType() {
			return false;
		}

		@Override
		public String fullName() {
			return className;
		}

		@Override
		public JClass toType(Outline o, Aspect aspect) {
			return o.getCodeModel().ref(className);
		}

		@Override
		public boolean isAbstract() {
			return false;
		}
	};
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:25,代码来源:XJCCMInfoFactory.java


示例16: createListType

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
@Override
protected NType createListType(final NType elementType) {

	return new NClass() {

		public boolean isBoxedType() {
			return false;
		}

		public String fullName() {
			return List.class.getName();
		}

		public JClass toType(Outline o, Aspect aspect) {
			return o.getCodeModel().ref(List.class)
					.narrow(elementType.toType(o, aspect).boxify());
		}

		public boolean isAbstract() {
			return false;
		}
	};
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:24,代码来源:XJCCMInfoFactory.java


示例17: processWrapperElementPropertyInfo

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
protected void processWrapperElementPropertyInfo(
		final MModelInfo<NType, NClass> mmodel,
		final MClassInfo<NType, NClass> rootClassInfo,
		final MElementPropertyInfo<NType, NClass> wrapperPropertyInfo) {
	wrapperPropertyInfo.getTypeInfo().acceptTypeInfoVisitor(
			new DefaultTypeInfoVisitor<NType, NClass, Void>() {
				@Override
				public Void visitClassInfo(
						final MClassInfo<NType, NClass> wrapperClassInfo) {
					if (/*
						 * TODO !getIgnoring ( ).isIgnored ( classInfo ) &&
						 */wrapperClassInfo.getProperties().size() == 1) {
						final MPropertyInfo<NType, NClass> wrappedPropertyInfo = wrapperClassInfo
								.getProperties().get(0);

						if (wrappedPropertyInfo.isCollection()) {
							processWrappedPropertyInfo(mmodel,
									rootClassInfo, wrapperPropertyInfo,
									wrapperClassInfo, wrappedPropertyInfo);
						}
					}
					return null;
				}
			});
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:26,代码来源:ElementWrapperPlugin.java


示例18: findClassOutline

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public static ClassOutline findClassOutline(Outline outline, QName type) {
    Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
    for (Map.Entry<NClass, CClassInfo> entry : set) {
        ClassOutline classOutline = outline.getClazz(entry.getValue());
        QName qname = entry.getValue().getTypeName();
        if (!type.equals(qname)) {
            continue;
        }

        return classOutline;
    }

    throw new IllegalStateException("Object type class defined by qname '" + type + "' outline was not found.");
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:15,代码来源:ProcessorUtils.java


示例19: updateFields

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
private void updateFields(Outline outline) {
  	Map<JDefinedClass, List<JFieldVar>> allFieldsToBeRemoved = new HashMap<>();

      Set<Map.Entry<NClass, CClassInfo>> set = outline.getModel().beans().entrySet();
      for (Map.Entry<NClass, CClassInfo> entry : set) {
          ClassOutline classOutline = outline.getClazz(entry.getValue());

          JDefinedClass implClass = classOutline.implClass;
          Map<String, JFieldVar> fields = implClass.fields();

          if (fields == null) {
              continue;
          }

	print("Updating fields and get/set methods: " + classOutline.implClass.fullName());

	for (String field : fields.keySet()) {
              JFieldVar fieldVar = fields.get(field);
		// marks a:rawType fields with @Raw - this has to be executed for any bean, not only for prism containers
              if (hasAnnotation(classOutline, fieldVar, A_RAW_TYPE) != null) {
                  annotateFieldAsRaw(fieldVar);
              }
          }

	if (isContainer(classOutline.implClass, outline)) {
		processContainerFields(classOutline, allFieldsToBeRemoved);
	}
	createFluentFieldMethods(classOutline, classOutline);

	print("Finished updating fields and get/set methods for " + classOutline.implClass.fullName());
      }

      allFieldsToBeRemoved.forEach((jDefinedClass, jFieldVars) -> {
      	jFieldVars.forEach(field -> jDefinedClass.removeField(field));
});
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:37,代码来源:SchemaProcessor.java


示例20: ConstantPropertyOutline

import com.sun.tools.xjc.model.nav.NClass; //导入依赖的package包/类
public ConstantPropertyOutline(Outline outline, MClassOutline classOutline,
		MPropertyInfo<NType, NClass> target, final JExpression value) {
	super(outline, classOutline, target);
	Validate.notNull(value);
	this.value = value;
	this.field = generateField();
}
 
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:8,代码来源:ConstantPropertyOutline.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SelectorParseException类代码示例发布时间:2022-05-23
下一篇:
Java CompositePackagingElement类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap