本文整理汇总了Java中lucee.runtime.Component.getProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getProperties方法的具体用法?Java Component.getProperties怎么用?Java Component.getProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lucee.runtime.Component
的用法示例。
在下文中一共展示了Component.getProperties方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inheritance
import lucee.runtime.Component; //导入方法依赖的package包/类
private static Query inheritance(PageContext pc,HibernateORMSession session,Component cfc,Query qry, String entityName) throws PageException {
Property[] properties = cfc.getProperties(true);
ComponentScope scope = cfc.getComponentScope();
Object value;
Array arr;
for(int i=0;i<properties.length;i++){
value=scope.get(CommonUtil.createKey(properties[i].getName()),null);
if(value instanceof Component){
qry=inheritance(pc,session,qry,cfc,(Component) value,entityName);
}
else if(CommonUtil.isArray(value)){
arr = CommonUtil.toArray(value);
Iterator<Object> it = arr.valueIterator();
while(it.hasNext()){
value=it.next();
if(value instanceof Component){
qry=inheritance(pc,session,qry,cfc,(Component) value,entityName);
}
}
}
}
return qry;
}
示例2: _toPojo
import lucee.runtime.Component; //导入方法依赖的package包/类
private static Pojo _toPojo(PageContext pc, Pojo pojo, TypeMapping tm,TypeEntry typeEntry,QName type,Component comp, Set<Object> done) throws PageException {//print.ds();System.exit(0);
comp=ComponentSpecificAccess.toComponentSpecificAccess(Component.ACCESS_PRIVATE,comp);
ComponentScope scope = comp.getComponentScope();
// create Pojo
if(pojo==null) {
try {
pojo = (Pojo) ClassUtil.loadInstance(ComponentUtil.getComponentPropertiesClass(pc,comp));
} catch (ClassException e) {
throw Caster.toPageException(e);
}
}
// initialize Pojo
Property[] props=comp.getProperties(false, true, false, false);
_initPojo(pc,typeEntry,type,pojo,props,scope,comp,tm,done);
return pojo;
}
示例3: toAMFObject
import lucee.runtime.Component; //导入方法依赖的package包/类
protected ASObject toAMFObject(Component cfc) throws PageException {
ASObject aso = new ASObject();
aso.setType(cfc.getCallName());
Component c=ComponentSpecificAccess.toComponentSpecificAccess(methodAccessLevel,cfc);
Property[] prop = cfc.getProperties(false);
Object v; UDF udf;
if(prop!=null)for(int i=0;i<prop.length;i++) {
boolean remotingFetch = Caster.toBooleanValue(prop[i].getDynamicAttributes().get(REMOTING_FETCH,Boolean.TRUE),true);
if(!remotingFetch) continue;
v=cfc.get(prop[i].getName(),null);
if(v==null){
v=c.get("get"+prop[i].getName(),null);
if(v instanceof UDF){
udf=(UDF) v;
if(udf.getReturnType()==CFTypes.TYPE_VOID) continue;
if(udf.getFunctionArguments().length>0) continue;
try {
v=c.call(ThreadLocalPageContext.get(), udf.getFunctionName(), ArrayUtil.OBJECT_EMPTY);
} catch (PageException e) {
continue;
}
}
}
aso.put(toString(prop[i].getName(),forceCFCLower), toAMFObject(v));
}
return aso;
}
示例4: toAMFObject
import lucee.runtime.Component; //导入方法依赖的package包/类
private Object toAMFObject(Component c) throws PageException {
ASObject aso = new ASObject();
Property[] prop = c.getProperties(false);
if(prop!=null)for(int i=0;i<prop.length;i++) {
aso.put(prop[i].getName().toUpperCase(), toAMFObject(c.get(prop[i].getName(),null)));
}
return aso;
}
示例5: getPropertiesAsStruct
import lucee.runtime.Component; //导入方法依赖的package包/类
public static Struct getPropertiesAsStruct(Component c, boolean onlyPersistent) {
Property[] props = c.getProperties(onlyPersistent);
Struct sct=new StructImpl();
if(props!=null)for(int i=0;i<props.length;i++){
sct.setEL(KeyImpl.getInstance(props[i].getName()), props[i]);
}
return sct;
}
示例6: getProperties
import lucee.runtime.Component; //导入方法依赖的package包/类
private static Property[] getProperties(PageContext pc, Component cfc, DatasourceConnection dc, Struct meta, boolean isClass, boolean recursivePersistentMappedSuperclass,SessionFactoryData data) throws PageException, PageException {
Property[] _props;
if (recursivePersistentMappedSuperclass) {
_props = CommonUtil.getProperties(cfc,true, true, true, true);
}
else {
_props = cfc.getProperties(true);
}
if(isClass && _props.length==0 && data.getORMConfiguration().useDBForMapping()){
if(meta==null)meta = cfc.getMetaData(pc);
_props=HibernateUtil.createPropertiesFromTable(dc,getTableName(pc, meta, cfc, data));
}
return _props;
}
示例7: getProperties
import lucee.runtime.Component; //导入方法依赖的package包/类
public static Property[] getProperties(Component component,int fieldType, Property[] defaultValue) {
Property[] props = component.getProperties(true);
java.util.List<Property> rtn=new ArrayList<Property>();
if(props!=null) {
for(int i=0;i<props.length;i++){
if(fieldType==getFieldType(props[i],FIELDTYPE_COLUMN))
rtn.add(props[i]);
}
}
return rtn.toArray(new Property[rtn.size()]);
}
示例8: _serializeStruct
import lucee.runtime.Component; //导入方法依赖的package包/类
/**
* serialize a Struct
* @param struct Struct to serialize
* @param sb
* @param serializeQueryByColumns
* @param addUDFs
* @param done
* @throws ConverterException
*/
public void _serializeStruct(PageContext pc,Set test,Struct struct, StringBuilder sb, boolean serializeQueryByColumns, boolean addUDFs, Set<Object> done) throws ConverterException {
// Component
if(struct instanceof Component){
String res = castToJson(pc, (Component)struct, NULL_STRING);
if(res!=NULL_STRING) {
sb.append(res);
return;
}
}
sb.append(goIn());
sb.append("{");
//Key[] keys = struct.keys();
//Key key;
Iterator<Entry<Key, Object>> it = struct.entryIterator();
Entry<Key, Object> e;
Object value;
boolean doIt=false;
while(it.hasNext()) {
e = it.next();
//key=keys[i];
value=e.getValue();
if(!addUDFs && (value instanceof UDF || value==null))continue;
if(doIt)sb.append(',');
doIt=true;
sb.append(StringUtil.escapeJS(e.getKey().getString(),'"',charsetEncoder));
sb.append(':');
_serialize(pc,test,value,sb,serializeQueryByColumns,done);
}
if(struct instanceof Component){
Boolean remotingFetch;
Component cfc = (Component)struct;
boolean isPeristent=false;
isPeristent=ComponentProUtil.isPersistent(cfc);
Property[] props = cfc.getProperties(false);
ComponentScope scope = cfc.getComponentScope();
for(int i=0;i<props.length;i++) {
if(!ignoreRemotingFetch) {
remotingFetch=Caster.toBoolean(props[i].getDynamicAttributes().get(REMOTING_FETCH,null),null);
if(remotingFetch==null){
if(isPeristent && ORMUtil.isRelated(props[i])) continue;
}
else if(!remotingFetch.booleanValue()) continue;
}
Key key = KeyImpl.getInstance(props[i].getName());
value=scope.get(key,null);
if(!addUDFs && (value instanceof UDF || value==null))continue;
if(doIt)sb.append(',');
doIt=true;
sb.append(StringUtil.escapeJS(key.getString(),'"',charsetEncoder));
sb.append(':');
_serialize(pc,test,value,sb,serializeQueryByColumns,done);
}
}
sb.append('}');
}
示例9: createFKColumnName
import lucee.runtime.Component; //导入方法依赖的package包/类
private static String createFKColumnName(Component cfc, Property prop, PropertyCollection propColl, SessionFactoryData data) throws PageException {
// fk column from local defintion
String str=prop==null?null:toString(cfc,prop,prop.getDynamicAttributes(),"fkcolumn",data);
if(!Util.isEmpty(str))
return str;
// no local defintion, get from Foreign enity
Struct meta = prop.getDynamicAttributes();
String type=toString(cfc,prop,meta,"fieldtype",false,data);
String otherType;
if("many-to-one".equalsIgnoreCase(type)) otherType="one-to-many";
else if("one-to-many".equalsIgnoreCase(type)) otherType="many-to-one";
else return createM2MFKColumnName( cfc, prop, propColl,data);
String feName = toString(cfc,prop,meta,"cfc",true,data);
Component feCFC=data.getEntityByCFCName(feName, false);
Property[] feProps = feCFC.getProperties(true);
Property p;
Component _cfc;
for(int i=0;i<feProps.length;i++){
p=feProps[i];
// compare fieldType
str=toString(feCFC,p,p.getDynamicAttributes(),"fieldtype",false,data);
if(!otherType.equalsIgnoreCase(str)) continue;
// compare cfc
str=toString(feCFC,p,p.getDynamicAttributes(),"cfc",false,data);
if(Util.isEmpty(str)) continue;
_cfc=data.getEntityByCFCName(str, false);
if(_cfc==null || !_cfc.equals(cfc))continue;
// get fkcolumn
str=toString(_cfc,p,p.getDynamicAttributes(),"fkcolumn",data);
if(!Util.isEmpty(str)) return str;
}
throw ExceptionUtil.createException(data,null,"cannot terminate foreign key column name for component "+cfc.getName(),null);
}
示例10: _serializeStruct
import lucee.runtime.Component; //导入方法依赖的package包/类
/**
* serialize a Struct
* @param struct Struct to serialize
* @param sb
* @param serializeQueryByColumns
* @param addUDFs
* @param done
* @throws ConverterException
*/
public void _serializeStruct(PageContext pc,Set test,Struct struct, StringBuilder sb, boolean serializeQueryByColumns, boolean addUDFs, Set<Object> done) throws ConverterException {
// Component
if(struct instanceof Component){
String res = castToJson(pc, (Component)struct, NULL_STRING);
if(res!=NULL_STRING) {
sb.append(res);
return;
}
}
sb.append(goIn());
sb.append("{");
//Key[] keys = struct.keys();
//Key key;
Iterator<Entry<Key, Object>> it = struct.entryIterator();
Entry<Key, Object> e;
Object value;
boolean doIt=false;
while(it.hasNext()) {
e = it.next();
//key=keys[i];
value=e.getValue();
if(!addUDFs && (value instanceof UDF || value==null))continue;
if(doIt)sb.append(',');
doIt=true;
sb.append(StringUtil.escapeJS(e.getKey().getString(),'"',charsetEncoder));
sb.append(':');
_serialize(pc,test,value,sb,serializeQueryByColumns,done);
}
if(struct instanceof Component){
Boolean remotingFetch;
Component comp = (Component)struct;
boolean isPeristent=false;
isPeristent=comp.isPersistent();
Property[] props = comp.getProperties(false);
ComponentScope scope = comp.getComponentScope();
for(int i=0;i<props.length;i++) {
if(!ignoreRemotingFetch) {
remotingFetch=Caster.toBoolean(props[i].getDynamicAttributes().get(REMOTING_FETCH,null),null);
if(remotingFetch==null){
if(isPeristent && ORMUtil.isRelated(props[i])) continue;
}
else if(!remotingFetch.booleanValue()) continue;
}
Key key = KeyImpl.getInstance(props[i].getName());
value=scope.get(key,null);
if(!addUDFs && (value instanceof UDF || value==null))continue;
if(doIt)sb.append(',');
doIt=true;
sb.append(StringUtil.escapeJS(key.getString(),'"',charsetEncoder));
sb.append(':');
_serialize(pc,test,value,sb,serializeQueryByColumns,done);
}
}
sb.append('}');
}
示例11: getProperties
import lucee.runtime.Component; //导入方法依赖的package包/类
public static Property[] getProperties(Component c,boolean onlyPeristent, boolean includeBaseProperties, boolean preferBaseProperties, boolean inheritedMappedSuperClassOnly) {
return c.getProperties(onlyPeristent, includeBaseProperties,preferBaseProperties,preferBaseProperties);
}
示例12: getProperties
import lucee.runtime.Component; //导入方法依赖的package包/类
private static Property[] getProperties(Component cfc) {
return cfc.getProperties(true,true,false,false);
}