本文整理匯總了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();
}
});
}
}
示例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();
}
示例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;
}
示例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 ) );
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}