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


Java Property.getGetter方法代码示例

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


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

示例1: buildPropertyGetter

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
@Override
   protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
	return mappedProperty.getGetter( mappedEntity.getMappedClass() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:PojoEntityTuplizer.java

示例2: buildGetter

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
protected Getter buildGetter(Component component, Property prop) {
	return prop.getGetter( component.getComponentClass() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:PojoComponentTuplizer.java

示例3: extractColumnValues

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public String extractColumnValues(){
	StringBuffer sb = new StringBuffer();
	//add the pk column and value
	sb.append(extractPrimaryKeyColumn() + " = " + extractPrimaryKeyValue() + " | ");
	//loop through all the other properties and get what you need
	for (String p: properties){
		Property pr = pc.getProperty(p);
	
		//make sure that this is not a collection and not a one to one as these values are not part of the table
		if (!pr.getType().isCollectionType() && !(pr.getType() instanceof OneToOneType)) {
			//make sure that the values are persistent values and not a forumla value
			if (pr.isInsertable() || pr.isUpdateable()) {
				int scale = 2;
				//get the getter for the entity
				Getter getter = pr.getGetter(entity.getClass());
				//get column value
				Object columnValue = getter.get(entity);
				//get column name
				for (Iterator it3 = pr.getColumnIterator(); it3.hasNext();) {
					Column column = (Column)it3.next();
					sb.append(column.getName());
					scale = column.getScale();
				}
				sb.append(" = ");
				//check what kind of type of value this is, it if it an association then get the forign key value from the associated entity
				if (columnValue != null) {
					if (!pr.getType().isAssociationType()) {
						//if bigD set Scale
						if (columnValue instanceof BigDecimal) {
							columnValue = ((BigDecimal)columnValue).setScale(scale,BigDecimal.ROUND_HALF_DOWN);
						} else if (columnValue instanceof java.util.Date) {
							SimpleDateFormat sdf = null;
							if(columnValue instanceof java.sql.Timestamp){
								sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
							}else{
								sdf = new SimpleDateFormat(DATE_FORMAT);
							}
							columnValue = sdf.format(columnValue);
						} else if (pr.getType().getName().equalsIgnoreCase("org.springframework.orm.hibernate3.support.ClobStringType")){
							columnValue = "Clob Value";
						}
						sb.append(columnValue);
					} else {
						//since it's an association we know that column value is an object
						String associatedEntityName = pr.getType().getName();
						//associatedEntityName = ((EntityType)pr.getType()).getAssociatedEntityName ();
						PersistentClass localPC = extractPersistentClass(associatedEntityName);
						String fkValue = extractPrimaryKeyValue(localPC,columnValue);
						sb.append(fkValue);
					}
				}
				sb.append(" | ");
			}
		}
	}
	return sb.toString();
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:59,代码来源:EntityParser.java

示例4: buildPropertyGetter

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
@Override
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
  return mappedProperty.getGetter(mappedEntity.getMappedClass());
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:5,代码来源:OBDynamicTuplizer.java

示例5: buildPropertyGetter

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
	return mappedProperty.getGetter( mappedEntity.getMappedClass() );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:4,代码来源:PojoEntityTuplizer.java

示例6: HibernateEntityTableMappingImpl

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
public HibernateEntityTableMappingImpl(Configuration configuration) {
    if(configuration==null){
        throw new IllegalArgumentException("Null hibernate configuration");
    }
    LOG.debug("Found hibernate configuration.");

    this.configuration = configuration;
    HibernateHelper.registerConfiguration(configuration);

    //init entityTableMap
    Iterator<PersistentClass> it = configuration.getClassMappings();
    while(it.hasNext()){
        PersistentClass pClass = it.next();

        EntityMapping entityMapping = new EntityMapping();
        entityMapping.setName(pClass.getEntityName());

        Iterator<Property> iterator = pClass.getPropertyIterator();
        while(iterator.hasNext()){
            Property p = iterator.next();
            Getter getter = p.getGetter(pClass.getMappedClass());
            Member member = getter.getMember();
            //ignore the collection field
            if(Collection.class.isAssignableFrom(getter.getReturnType())){
                LOG.trace("ignore collection member :{}",member);
                continue;
            }

            Iterator<Selectable> colIt = p.getColumnIterator();
            Selectable selectable = colIt.next();
            if(selectable instanceof Column){
                Column col = (Column)selectable;
                String fieldName = ObjectUtils.getterField(member.getName());
                entityMapping.getFieldColumnMap().put(fieldName, col.getName());

                EntityField entityField = new EntityField(fieldName,getter.getReturnType().getName());
                entityMapping.getFieldMap().put(fieldName,entityField);
            }
        }
        entityTableMap.put(entityMapping.getName(), pClass.getTable().getName());
        entityMappingMap.put(entityMapping.getName(),entityMapping);

    }

    LOG.debug("{} entities detected",entityMappingMap.size());
}
 
开发者ID:yaohuiwu,项目名称:CAM,代码行数:47,代码来源:HibernateEntityTableMappingImpl.java

示例7: buildGetter

import org.hibernate.mapping.Property; //导入方法依赖的package包/类
@Override
protected Getter buildGetter(Component component, Property prop) {
    prop.setPropertyAccessorName(OptionAwareDirectPropertyAccessor.class.getName());
    return prop.getGetter(component.getComponentClass());
}
 
开发者ID:solita,项目名称:query-utils,代码行数:6,代码来源:OptionAwarePojoComponentTuplizer.java


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