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


Java Element.element方法代码示例

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


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

示例1: dealXmlElementAnnotation

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 处理@{@link XmlElement}注解
 */
@SuppressWarnings("unchecked")
protected void dealXmlElementAnnotation(Element rootElement, Field field, Object entity) {
  XmlElement xmlElementAnnotation = field.getAnnotation(XmlElement.class);
  Element element = rootElement.element(xmlElementAnnotation.name());
  if (Objects.nonNull(element)) {
    Optional<Object> valueOptional = super
        .elementValue(rootElement, field.getType(), xmlElementAnnotation.name());
    valueOptional.ifPresent(value -> {
      try {
        field.set(entity, value);
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      }
    });
  }
}
 
开发者ID:minlia-projects,项目名称:minlia-iot,代码行数:20,代码来源:XmlApiDeserializer.java

示例2: getView

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 获得heaView的SQL
 * @return heaView里的SQL
 */
public String getView() {
	Map<String,Object> valueCacheMap=this.xmlCache.getValueMap();
	String path="view";
	if(null!=valueCacheMap.get(path)){

		return (String) valueCacheMap.get(path);
	}
	Element rootElement = document.getRootElement();
	Element hqlsElement = rootElement.element(VIEW );
	if (null == hqlsElement) {
		return null;
	}
	 valueCacheMap.put(path, hqlsElement.getTextTrim());
     return hqlsElement.getTextTrim();
}
 
开发者ID:VonChange,项目名称:headb,代码行数:20,代码来源:HXmlUtils.java

示例3: buildAttributeOverrides

import org.dom4j.Element; //导入方法依赖的package包/类
private List<AttributeOverride> buildAttributeOverrides(List<Element> subelements, String nodeName) {
	List<AttributeOverride> overrides = new ArrayList<AttributeOverride>();
	if ( subelements != null && subelements.size() > 0 ) {
		for ( Element current : subelements ) {
			if ( !current.getName().equals( nodeName ) ) {
				continue;
			}
			AnnotationDescriptor override = new AnnotationDescriptor( AttributeOverride.class );
			copyStringAttribute( override, current, "name", true );
			Element column = current.element( "column" );
			override.setValue( "column", getColumn( column, true, current ) );
			overrides.add( (AttributeOverride) AnnotationFactory.create( override ) );
		}
	}
	return overrides;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:JPAOverriddenAnnotationReader.java

示例4: getTemporal

import org.dom4j.Element; //导入方法依赖的package包/类
private void getTemporal(List<Annotation> annotationList, Element element) {
	Element subElement = element != null ? element.element( "temporal" ) : null;
	if ( subElement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Temporal.class );
		String temporal = subElement.getTextTrim();
		if ( "DATE".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.DATE );
		}
		else if ( "TIME".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.TIME );
		}
		else if ( "TIMESTAMP".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.TIMESTAMP );
		}
		else if ( StringHelper.isNotEmpty( temporal ) ) {
			throw new AnnotationException( "Unknown TemporalType: " + temporal + ". " + SCHEMA_VALIDATION );
		}
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:JPAOverriddenAnnotationReader.java

示例5: parserVars

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * 解析变量配置
 * @param node  settings节点
 * @return 返回解析完的所有变量
 */
public static Map<String,Object> parserVars(Element node){
    Map<String,Object> vars = new HashMap<String, Object>();
    if(node!=null){
        Element varE = node.element("vars");
        if(varE!=null){
            //加在普通变量
            List<Element> childs = varE.elements("var");
            if(childs!=null&&childs.size()>0){
                for(Element c:childs){
                    vars.put(c.attributeValue("name"),c.attributeValue("value"));
                }
            }
            //加载map变量
            vars.putAll(parserVarMap(varE));
            //加载list变量
            vars.putAll(parserVarList(varE));
        }
    }
    return vars;
}
 
开发者ID:javahaohao,项目名称:gen_code,代码行数:26,代码来源:ConfigParser.java

示例6: generate

import org.dom4j.Element; //导入方法依赖的package包/类
public void generate() throws IOException, DocumentException {
	Document document = read(iConfig);
	Element root = document.getRootElement();
	Element sessionFactoryElement = root.element("session-factory");
	for (Iterator<Element> i = sessionFactoryElement.elementIterator("mapping"); i.hasNext(); ) {
		Element m = i.next();
		String resource = m.attributeValue("resource");
		if (resource == null) continue;
		generate(read(resource).getRootElement(), null);
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:DoubleVarcharSizes.java

示例7: initializeCreditUnitTypeData

import org.dom4j.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeCreditUnitTypeData(Element rootElement) throws Exception {
	for (CourseCreditUnitType creditUnitType : CourseCreditUnitType.getCourseCreditUnitTypeList()) {
		creditUnitTypesByRef.put(creditUnitType.getReference(), creditUnitType);
	}
			
	Element creditUnitTypesElement = rootElement.element(PointInTimeDataExport.sCreditUnitTypesElementName);
	for(Element creditUnitTypeElement : (List<Element>) creditUnitTypesElement.elements()){
		elementCreditUnitType(creditUnitTypeElement);
	}

}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:13,代码来源:PointInTimeDataImport.java

示例8: initializeClassDurationTypeData

import org.dom4j.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeClassDurationTypeData(Element rootElement) throws Exception {
	for (ClassDurationType classDurationType : ClassDurationType.findAll()) {
		classDurationTypes.put(classDurationType.getReference(), classDurationType);
	}
			
	Element classDurationTypesElement = rootElement.element(PointInTimeDataExport.sClassDurationTypesElementName);
	for(Element classDurationTypeElement : (List<Element>) classDurationTypesElement.elements()){
		elementClassDurationType(classDurationTypeElement);
	}
	
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:13,代码来源:PointInTimeDataImport.java

示例9: bindSimpleValueType

import org.dom4j.Element; //导入方法依赖的package包/类
private static void bindSimpleValueType(Element node, SimpleValue simpleValue, Mappings mappings)
		throws MappingException {
	String typeName = null;

	Properties parameters = new Properties();

	Attribute typeNode = node.attribute( "type" );
       if ( typeNode == null ) {
           typeNode = node.attribute( "id-type" ); // for an any
       }
       else {
           typeName = typeNode.getValue();
       }

	Element typeChild = node.element( "type" );
	if ( typeName == null && typeChild != null ) {
		typeName = typeChild.attribute( "name" ).getValue();
		Iterator typeParameters = typeChild.elementIterator( "param" );

		while ( typeParameters.hasNext() ) {
			Element paramElement = (Element) typeParameters.next();
			parameters.setProperty(
					paramElement.attributeValue( "name" ),
					paramElement.getTextTrim()
				);
		}
	}

	resolveAndBindTypeDef(simpleValue, mappings, typeName, parameters);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:HbmBinder.java

示例10: fromXml

import org.dom4j.Element; //导入方法依赖的package包/类
public static RecordedAssignment fromXml(Element element) {
	Hint before = null, after = null;
	if (element.element("before")!=null) {
		before = Hint.fromXml(element.element("before"));
	}
	if (element.element("after")!=null) {
		after = Hint.fromXml(element.element("after"));
	}
	return new RecordedAssignment(before, after);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:TimetableSolver.java

示例11: initializeTimePatternData

import org.dom4j.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void initializeTimePatternData(Element rootElement) throws Exception {
       loadExistingTimePatterns(session.getUniqueId());

       Element timePatternsElement = rootElement.element(PointInTimeDataExport.sTimePatternsElementName);
       for(Element timePatternElement : (List<Element>) timePatternsElement.elements()){
       	elementTimePattern(timePatternElement);
       }
	
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:11,代码来源:PointInTimeDataImport.java

示例12: getInheritance

import org.dom4j.Element; //导入方法依赖的package包/类
private Inheritance getInheritance(Element tree, XMLContext.Default defaults) {
	Element element = tree != null ? tree.element( "inheritance" ) : null;
	if ( element != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Inheritance.class );
		Attribute attr = element.attribute( "strategy" );
		InheritanceType strategy = InheritanceType.SINGLE_TABLE;
		if ( attr != null ) {
			String value = attr.getValue();
			if ( "SINGLE_TABLE".equals( value ) ) {
				strategy = InheritanceType.SINGLE_TABLE;
			}
			else if ( "JOINED".equals( value ) ) {
				strategy = InheritanceType.JOINED;
			}
			else if ( "TABLE_PER_CLASS".equals( value ) ) {
				strategy = InheritanceType.TABLE_PER_CLASS;
			}
			else {
				throw new AnnotationException(
						"Unknown InheritanceType in XML: " + value + " (" + SCHEMA_VALIDATION + ")"
				);
			}
		}
		ad.setValue( "strategy", strategy );
		return AnnotationFactory.create( ad );
	}
	else if ( defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( Inheritance.class );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:JPAOverriddenAnnotationReader.java

示例13: getIdClass

import org.dom4j.Element; //导入方法依赖的package包/类
private IdClass getIdClass(Element tree, XMLContext.Default defaults) {
	Element element = tree == null ? null : tree.element( "id-class" );
	if ( element != null ) {
		Attribute attr = element.attribute( "class" );
		if ( attr != null ) {
			AnnotationDescriptor ad = new AnnotationDescriptor( IdClass.class );
			Class clazz;
			try {
				clazz = ReflectHelper.classForName(
						XMLContext.buildSafeClassName( attr.getValue(), defaults ),
						this.getClass()
				);
			}
			catch ( ClassNotFoundException e ) {
				throw new AnnotationException( "Unable to find id-class: " + attr.getValue(), e );
			}
			ad.setValue( "value", clazz );
			return AnnotationFactory.create( ad );
		}
		else {
			throw new AnnotationException( "id-class without class. " + SCHEMA_VALIDATION );
		}
	}
	else if ( defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( IdClass.class );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:31,代码来源:JPAOverriddenAnnotationReader.java

示例14: getTableGenerator

import org.dom4j.Element; //导入方法依赖的package包/类
private Annotation getTableGenerator(List<Element> elementsForProperty, XMLContext.Default defaults) {
	for ( Element element : elementsForProperty ) {
		Element subelement = element != null ? element.element( annotationToXml.get( TableGenerator.class ) ) : null;
		if ( subelement != null ) {
			return buildTableGeneratorAnnotation( subelement, defaults );
		}
	}
	if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( TableGenerator.class );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:JPAOverriddenAnnotationReader.java

示例15: getSequenceGenerator

import org.dom4j.Element; //导入方法依赖的package包/类
private Annotation getSequenceGenerator(List<Element> elementsForProperty, XMLContext.Default defaults) {
	for ( Element element : elementsForProperty ) {
		Element subelement = element != null ? element.element( annotationToXml.get( SequenceGenerator.class ) ) : null;
		if ( subelement != null ) {
			return buildSequenceGeneratorAnnotation( subelement );
		}
	}
	if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( SequenceGenerator.class );
	}
	else {
		return null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:JPAOverriddenAnnotationReader.java


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