本文整理汇总了Java中org.apache.ojb.broker.accesslayer.conversions.FieldConversion类的典型用法代码示例。如果您正苦于以下问题:Java FieldConversion类的具体用法?Java FieldConversion怎么用?Java FieldConversion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldConversion类属于org.apache.ojb.broker.accesslayer.conversions包,在下文中一共展示了FieldConversion类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: saveValue
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
public void saveValue(Object objekt, Object value)
{
if ((this.fieldSource == SOURCE_FIELD) && (this.returnedByProcedure))
{
FieldDescriptor fd = this.getFieldRef();
FieldConversion conversion = null;
if (fd != null)
{
conversion = fd.getFieldConversion();
if (conversion == null)
{
fd.getPersistentField().set(objekt, value);
}
else
{
fd.getPersistentField().set(objekt, conversion.sqlToJava(value));
}
}
}
}
开发者ID:KualiCo,项目名称:ojb,代码行数:21,代码来源:ArgumentDescriptor.java
示例2: getAnnotationNodes
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
/** gets the annotation but also adds an import in the process if a Convert annotation is required. */
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
final FieldDescriptor fd = OjbUtil.findFieldDescriptor(mappedClass, fieldName, descriptorRepositories);
if (fd != null) {
final FieldConversion fc = fd.getFieldConversion();
//in ojb all columns have at least the default field conversion
if (fc != null && FieldConversionDefaultImpl.class != fc.getClass()) {
LOG.info(enclosingClass + "." + fieldName + " for the mapped class " + mappedClass + " field has a converter " + fc.getClass().getName());
final String jpaConverter = getJpaConverterForOjbClass(fc.getClass().getName());
if (jpaConverter == null) {
LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a converter " + fc.getClass().getName()
+ " but a replacement converter was not configured, unable to set Convert class");
return new NodeData(new NormalAnnotationExpr(new NameExpr(SIMPLE_NAME), Collections.singletonList(new MemberValuePair("converter", new NameExpr(null)))),
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false));
} else if ( StringUtils.isBlank(jpaConverter) ) {
LOG.info(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a converter " + fc.getClass().getName()
+ " But no converter definition is needed due to default converter configuration." );
} else {
final String shortClassName = ClassUtils.getShortClassName(jpaConverter);
final String packageName = ClassUtils.getPackageName(jpaConverter);
return new NodeData(new NormalAnnotationExpr(new NameExpr(SIMPLE_NAME), Collections.singletonList(new MemberValuePair("converter", new NameExpr(shortClassName + ".class")))),
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(packageName), shortClassName), false, false)));
}
}
}
return null;
}
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:ConvertResolver.java
示例3: getPkFieldConversion
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
/**
* Answer the FieldConversions for the PkFields
* @param cld
* @return the pk FieldConversions
*/
private FieldConversion[] getPkFieldConversion(ClassDescriptor cld)
{
FieldDescriptor[] pks = cld.getPkFields();
FieldConversion[] fc = new FieldConversion[pks.length];
for (int i= 0; i < pks.length; i++)
{
fc[i] = pks[i].getFieldConversion();
}
return fc;
}
开发者ID:KualiCo,项目名称:ojb,代码行数:18,代码来源:MtoNCollectionPrefetcher.java
示例4: convert
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
/**
* Convert the Values using the FieldConversion.sqlToJava
* @param fcs
* @param values
*/
private Object[] convert(FieldConversion[] fcs, Object[] values)
{
Object[] convertedValues = new Object[values.length];
for (int i= 0; i < values.length; i++)
{
convertedValues[i] = fcs[i].sqlToJava(values[i]);
}
return convertedValues;
}
开发者ID:KualiCo,项目名称:ojb,代码行数:17,代码来源:MtoNCollectionPrefetcher.java
示例5: setFieldConversionClassName
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
/**
* Sets the fieldConversion.
* @param fieldConversionClassName The fieldConversion to set
*/
public void setFieldConversionClassName(String fieldConversionClassName)
{
try
{
this.fieldConversion = (FieldConversion) ClassHelper.newInstance(fieldConversionClassName);
}
catch (Exception e)
{
throw new MetadataException(
"Could not instantiate FieldConversion class using default constructor", e);
}
}
开发者ID:KualiCo,项目名称:ojb,代码行数:17,代码来源:FieldDescriptor.java
示例6: getValue
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
public Object getValue(Object objekt)
{
switch (this.fieldSource)
{
case SOURCE_FIELD :
if (objekt == null)
{
return null;
}
else
{
FieldDescriptor fd = this.getFieldRef();
Object value = null;
FieldConversion conversion = null;
if (fd != null)
{
conversion = fd.getFieldConversion();
value = fd.getPersistentField().get(objekt);
if (conversion != null)
{
value = conversion.javaToSql(value);
}
}
return value;
}
case SOURCE_VALUE :
return this.constantValue;
case SOURCE_NULL :
return null;
default :
return null;
}
}
开发者ID:KualiCo,项目名称:ojb,代码行数:34,代码来源:ArgumentDescriptor.java
示例7: setFieldConversion
import org.apache.ojb.broker.accesslayer.conversions.FieldConversion; //导入依赖的package包/类
/**
* Sets the fieldConversion.
* @param fieldConversion The fieldConversion to set
* @deprecated use setFieldConversionClassName instead
*/
public void setFieldConversion(FieldConversion fieldConversion)
{
this.fieldConversion = fieldConversion;
}
开发者ID:KualiCo,项目名称:ojb,代码行数:10,代码来源:FieldDescriptor.java
注:本文中的org.apache.ojb.broker.accesslayer.conversions.FieldConversion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论