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


Java Node.getChildren方法代码示例

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


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

示例1: annotations

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
@Override
public List<Annotation> annotations() {
	ArrayList<Annotation>results=new ArrayList<>();
	
	Node node=this.original;
	if (node==null){
		return Collections.emptyList();
	}
	if (node instanceof KeyValueNode){
		KeyValueNode kv=(KeyValueNode) node;
		node=kv.getValue();
	}
	for (Node n:node.getChildren()){
		if (n instanceof AnnotationNode){
			AnnotationNode mn=(AnnotationNode) n;
			Object val=TopLevelRamlModelBuilder.toObject(mn.getValue());
			String literalValue = mn.getKey().getLiteralValue();
			Annotation as = new Annotation(literalValue.substring(1, literalValue.length() - 1), val, null);
			TopLevelRamlModelBuilder.bindAnnotation(this.getTopLevel(), as);
			results.add(as);
		}
	}
	return results;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:25,代码来源:AnnotableImpl.java

示例2: getStringList

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
public List<String> getStringList(String key) {
	Node childNodeWithKey = this.getChildNodeWithKey(key);
	ArrayList<String>results=new ArrayList<>();
	if (childNodeWithKey!=null){
		if (childNodeWithKey instanceof SYStringNode){
			results.add(((SYStringNode) childNodeWithKey).getLiteralValue());
		}
		else for (Node n:childNodeWithKey.getChildren()){
			if (n instanceof SimpleTypeNode){
				SimpleTypeNode<?>tn=(SimpleTypeNode<?>) n;
				results.add(tn.getLiteralValue());
			}
			
		}
	}
	return results;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:18,代码来源:AnnotableImpl.java

示例3: getChildNodeWithKey

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
protected Node getChildNodeWithKey(String key) {
	Node nodeo=this.original;
	if (nodeo==null){
		return null;
	}
	if (nodeo instanceof KeyValueNode){
		KeyValueNode kv=(KeyValueNode) nodeo;
		nodeo=kv.getValue();
	}
	for (Node n:nodeo.getChildren()){
		if (n instanceof KeyValueNode){
			KeyValueNode node=(KeyValueNode) n;
			if (node.getKey() instanceof StringNode){
				StringNode nnm=(StringNode) node.getKey();
				if (nnm.getValue().equals(key)){
					Node value = node.getValue();
					return value;
				}
			}
		}
	}
	return null;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:24,代码来源:AnnotableImpl.java

示例4: securedBy

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
public ArrayList<SecuredByConfig> securedBy() {
	ArrayList<SecuredByConfig> results = new ArrayList<>();
	Node childNodeWithKey = this.getChildNodeWithKey("securedBy");
	if (childNodeWithKey != null) {
		for (Node n : childNodeWithKey.getChildren()) {
			if (n instanceof ErrorNode) {
				ErrorNode zz = (ErrorNode) n;
				Node source = zz.getSource();
				if (source instanceof org.raml.v2.internal.impl.commons.nodes.ParametrizedSecuritySchemeRefNode) {
					n = source;
				}
			}
			results.add(new SecuredByImpl(mdl, this, n));
		}
	}
	return results;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:18,代码来源:AbstractWrappedNodeImpl.java

示例5: getUsesLocations

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
public LinkedHashMap<String, String> getUsesLocations() {
	LinkedHashMap<String, String> results = new LinkedHashMap<>();
	Node childNodeWithKey = getChildNodeWithKey("uses");
	if (childNodeWithKey != null) {
		for (Node ch : childNodeWithKey.getChildren()) {
			if (ch instanceof LibraryNode) {
				LibraryNode ln = (LibraryNode) ch;
				LibraryLinkNode lnv = (LibraryLinkNode) ln.getValue();
				if (lnv != null) {
					String path = lnv.getRefName();
					String key =( (SYStringNode) ln.getKey()).getLiteralValue();
					results.put(key, path);
				}
			}				
		}
	}
	return results;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:19,代码来源:TopLevelRamlImpl.java

示例6: emit

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
public void emit(Api api, Writer w) throws IOException {

        w.write("#%RAML 1.0");
        NodeModel model = (NodeModel) api;
        Node node = model.getNode();

        for (Node o : node.getChildren()) {

            list.handle(o, createEmitter(w));
        }
    }
 
开发者ID:mulesoft-labs,项目名称:raml-java-tools,代码行数:12,代码来源:Emitter.java

示例7: responses

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
@Override
public List<Response> responses() {
	ArrayList<Response> result = new ArrayList<>();
	Node childNodeWithKey = this.getChildNodeWithKey("responses");
	if (childNodeWithKey != null) {
		for (Node n : childNodeWithKey.getChildren()) {
			if (n instanceof KeyValueNode){
				KeyValueNode rn=(KeyValueNode) n;
				result.add(new ResponseImpl(mdl,this,rn));
			}
		}
	}
	return result;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:15,代码来源:MethodImpl.java

示例8: getNodeWithKey

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
private <V> V getNodeWithKey(String key, Class<V> cl, Node inode) {
	for (Node n:inode.getChildren()){
		if (n instanceof KeyValueNode){
			KeyValueNode node=(KeyValueNode) n;
			if (node.getKey() instanceof StringNode){
				StringNode nnm=(StringNode) node.getKey();
				if (nnm.getValue().equals(key)){
					Node value = node.getValue();
					if (value instanceof SimpleTypeNode<?>){
						SimpleTypeNode<?>vl=(SimpleTypeNode<?>) value;
						if (cl.isInstance(vl.getValue())){
							return cl.cast(vl.getValue());
						}
					}
					if (value instanceof ObjectNode){
						ObjectNode on=(ObjectNode) value;
						List<Node> children = on.getChildren();
						if (children.size()==1){
							Node nm = children.get(0);
							if (nm instanceof KeyValueNode){
								KeyValueNode val=(KeyValueNode) nm;
								Node actualValue=val.getValue();
								if (actualValue instanceof SimpleTypeNode<?>){
									SimpleTypeNode<?>st=(SimpleTypeNode<?>) actualValue;
									if (cl.isInstance(st.getValue())){
										return cl.cast(st.getValue());
									}
								}
							}
						}
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:38,代码来源:AnnotableImpl.java

示例9: documentation

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
@Override
public List<DocumentationItem> documentation() {
	Node childNodeWithKey = this.getChildNodeWithKey("documentation");
	ArrayList<DocumentationItem>docs=new ArrayList<>();
	if (childNodeWithKey!=null){
		for (Node n:childNodeWithKey.getChildren()){
			docs.add(new DocumentationItemImpl(this, this, n));
		}
	}
	return docs;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:12,代码来源:ApiImpl.java

示例10: getSuperType08

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
private AbstractType getSuperType08(Node na, TopLevelRamlImpl raml) {
	for (Node n : na.getChildren()) {
		if (n instanceof KeyValueNode) {
			KeyValueNode k = (KeyValueNode) n;
			Node key = k.getKey();
			if (key instanceof StringNode) {
				StringNode sn = (StringNode) key;
				String literalValue = sn.getLiteralValue();
				Object vl = toObject(k.getValue());
				String typeName = "" + vl;
				if (literalValue.equals("schema")) {
					if (raml.topLevelTypes.hasDeclaration(typeName)) {
						return raml.topLevelTypes.getType(typeName);
					}
					return TypeOps.deriveExternal("", typeName);
				}
				if (literalValue.equals("formParameters")) {
					AbstractType derive = TypeOps.derive("", BuiltIns.OBJECT);
					List<Node> children = k.getValue().getChildren();
					parseProperties(raml, false, derive, children, true);
					return derive;
				}
				if (literalValue.equals("type")) {
					return TypeOps.derive("", BuiltIns.getBuiltInTypes().getType(typeName));
				}
			}
		}
	}
	return BuiltIns.STRING;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:31,代码来源:TopLevelRamlModelBuilder.java

示例11: securityDefinitions

import org.raml.yagi.framework.nodes.Node; //导入方法依赖的package包/类
@Override
public List<SecurityScheme> securityDefinitions() {
	ArrayList<SecurityScheme> result = new ArrayList<>();
	Node childNodeWithKey = this.getChildNodeWithKey("securitySchemes");
	if (childNodeWithKey != null) {
		for (Node n : childNodeWithKey.getChildren()) {
			if (n instanceof SecuritySchemeNode) {
				SecuritySchemeNode sn = (SecuritySchemeNode) n;
				result.add(new SecuritySchemeImpl(this, this, sn));
			}
		}
	}
	return result;
}
 
开发者ID:OnPositive,项目名称:aml,代码行数:15,代码来源:TopLevelRamlImpl.java


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