use of lucee.runtime.type.Array in project Lucee by lucee.
the class _GetElement method toStruct.
@Override
public Object toStruct() {
Resource[] locs = getCfcLocations();
Array arrLocs = new ArrayImpl();
if (locs != null)
for (int i = 0; i < locs.length; i++) {
arrLocs.appendEL(getAbsolutePath(locs[i]));
}
Struct sct = new StructImpl();
sct.setEL(AUTO_GEN_MAP, this.autogenmap());
sct.setEL(CATALOG, StringUtil.emptyIfNull(getCatalog()));
sct.setEL(CFC_LOCATION, arrLocs);
sct.setEL(IS_DEFAULT_CFC_LOCATION, isDefaultCfcLocation());
sct.setEL(DB_CREATE, dbCreateAsString(getDbCreate()));
sct.setEL(DIALECT, StringUtil.emptyIfNull(getDialect()));
sct.setEL(EVENT_HANDLING, eventHandling());
sct.setEL(EVENT_HANDLER, eventHandler());
sct.setEL(NAMING_STRATEGY, namingStrategy());
sct.setEL(FLUSH_AT_REQUEST_END, flushAtRequestEnd());
sct.setEL(LOG_SQL, logSQL());
sct.setEL(SAVE_MAPPING, saveMapping());
sct.setEL(SCHEMA, StringUtil.emptyIfNull(getSchema()));
sct.setEL(SECONDARY_CACHE_ENABLED, secondaryCacheEnabled());
sct.setEL(SQL_SCRIPT, StringUtil.toStringEmptyIfNull(getSqlScript()));
sct.setEL(USE_DB_FOR_MAPPING, useDBForMapping());
sct.setEL(CACHE_CONFIG, getAbsolutePath(getCacheConfig()));
sct.setEL(CACHE_PROVIDER, StringUtil.emptyIfNull(getCacheProvider()));
sct.setEL(ORM_CONFIG, getAbsolutePath(getOrmConfig()));
return sct;
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class Reflector method toNativeArray.
private static Object toNativeArray(Class clazz, Object obj) throws PageException {
// if(obj.getClass()==clazz) return obj;
Object[] objs = null;
if (obj instanceof Array)
objs = toRefArray((Array) obj);
else if (obj instanceof List)
objs = toRefArray((List) obj);
else if (Decision.isNativeArray(obj)) {
if (obj.getClass() == boolean[].class)
objs = toRefArray((boolean[]) obj);
else if (obj.getClass() == byte[].class)
objs = toRefArray((byte[]) obj);
else if (obj.getClass() == char[].class)
objs = toRefArray((char[]) obj);
else if (obj.getClass() == short[].class)
objs = toRefArray((short[]) obj);
else if (obj.getClass() == int[].class)
objs = toRefArray((int[]) obj);
else if (obj.getClass() == long[].class)
objs = toRefArray((long[]) obj);
else if (obj.getClass() == float[].class)
objs = toRefArray((float[]) obj);
else if (obj.getClass() == double[].class)
objs = toRefArray((double[]) obj);
else
// toRefArray((Object[])obj);
objs = (Object[]) obj;
}
if (clazz == objs.getClass()) {
return objs;
}
// if(objs==null) return defaultValue;
// Class srcClass = objs.getClass().getComponentType();
Class compClass = clazz.getComponentType();
Object rtn = java.lang.reflect.Array.newInstance(compClass, objs.length);
// try{
for (int i = 0; i < objs.length; i++) {
java.lang.reflect.Array.set(rtn, i, convert(objs[i], compClass, null));
}
return rtn;
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class SoftMethodStorage method storeMethod.
/**
* stores a single method
* @param method
* @param methodsMap
*/
private void storeMethod(Method method, Map<Key, Array> methodsMap) {
Key methodName = KeyImpl.init(method.getName());
Array methodArgs;
synchronized (methodsMap) {
methodArgs = methodsMap.get(methodName);
if (methodArgs == null) {
methodArgs = new ArrayImpl();
methodsMap.put(methodName, methodArgs);
}
}
storeArgs(method, methodArgs);
// Modifier.isStatic(method.getModifiers());
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class WeakConstructorStorage method getConstructors.
/**
* returns a constructor matching given criteria or null if Constructor doesn't exist
* @param clazz Class to get Constructor for
* @param count count of arguments for the constructor
* @return returns the constructors
*/
public Constructor[] getConstructors(Class clazz, int count) {
Array con;
Object o;
synchronized (map) {
o = map.get(clazz);
if (o == null) {
con = store(clazz);
} else
con = (Array) o;
}
o = con.get(count + 1, null);
if (o == null)
return null;
return (Constructor[]) o;
}
use of lucee.runtime.type.Array in project Lucee by lucee.
the class Perl5Util method match.
public static Array match(String strPattern, String strInput, int offset, boolean caseSensitive) throws MalformedPatternException {
Perl5Matcher matcher = new Perl5Matcher();
PatternMatcherInput input = new PatternMatcherInput(strInput);
int compileOptions = caseSensitive ? 0 : Perl5Compiler.CASE_INSENSITIVE_MASK;
compileOptions += Perl5Compiler.MULTILINE_MASK;
if (offset < 1)
offset = 1;
Pattern pattern = getPattern(strPattern, compileOptions);
Array rtn = new ArrayImpl();
MatchResult result;
while (matcher.contains(input, pattern)) {
result = matcher.getMatch();
rtn.appendEL(result.toString());
}
return rtn;
}
Aggregations