/** * Enables automatic import of classes used during code generation. * * @return the current context whit auto import enabled. */ public Context autoImport() { checkThread(); this.autoImportActive = true; return this; }
/** * Checks if automatic import is active. * * @return true if auto import active, otherwise false. */ public boolean isAutoImportActive() { checkThread(); return autoImportActive; }
/** * Enables automatic import of classes used during code generation. * * @return the current context whit auto import enabled. */ public Context autoImport() { checkThread(); this.autoImportActive = true; return this; }
/** * Sets permissive mode active for this context. * * @param permissiveMode */ public void setPermissiveMode(final boolean permissiveMode) { checkThread(); this.permissiveMode = permissiveMode; }
/** * Check is permissive mode is active for this context. * * @return */ public boolean isPermissiveMode() { checkThread(); return permissiveMode; }
/** * Check is permissive mode is active for this context. * * @return */ public boolean isPermissiveMode() { checkThread(); return permissiveMode; }
/** * Attaches a class to the current scope. * * @param clazz * class to attach. */ public void attachClass(final MetaClass clazz) { checkThread(); this.classContexts.add(clazz); }
/** * Attaches a class to the current scope. * * @param clazz * class to attach. */ public void attachClass(final MetaClass clazz) { checkThread(); this.classContexts.add(clazz); }
/** * Adds an {@link InterningCallback} to the context. Multiple callbacks can be registered. But, in the event that * multiple callbacks fire and intern the same values, the <em>last</em> callback fired will be the effective * interning behavior. * * @param interningCallback */ public void addInterningCallback(final InterningCallback interningCallback) { checkThread(); interningCallbackList.add(interningCallback); }
/** * Returns all variables in this scope (does not include variables of parent scopes). * * @return collection of {@link Variable}, empty if no variables are in scope. */ public Collection<Variable> getDeclaredVariables() { checkThread(); if (variables == null) return Collections.<Variable>emptyList(); return variables.values(); }
/** * Returns all variables in this scope (does not include variables of parent scopes). * * @return map of variable name to {@link Variable}, empty if no variables are in scope. */ public Map<String, Variable> getVariables() { checkThread(); if (variables == null) return Collections.<String, Variable>emptyMap(); return Collections.<String, Variable>unmodifiableMap(variables); }
public void addLiteralizableMetaClasses(final Collection<MetaClass> clazzes) { checkThread(); for (final MetaClass cls : clazzes) { addLiteralizableClass(cls); } }
private String getImportForClass(final MetaClass clazz) { checkThread(); String imp = null; final String fqcn = clazz.getCanonicalName(); final int idx = fqcn.lastIndexOf('.'); if (idx != -1) { imp = fqcn.substring(0, idx); } return imp; }
public void addLiteralizableMetaClasses(final Collection<MetaClass> clazzes) { checkThread(); for (final MetaClass cls : clazzes) { addLiteralizableClass(cls); } }
private String getImportForClass(final MetaClass clazz) { checkThread(); String imp = null; final String fqcn = clazz.getCanonicalName(); final int idx = fqcn.lastIndexOf('.'); if (idx != -1) { imp = fqcn.substring(0, idx); } return imp; }
public void addLiteralizableClasses(final Collection<Class<?>> clazzes) { checkThread(); for (final Class<?> cls : clazzes) { addLiteralizableClass(cls); } }
@SuppressWarnings("unchecked") public <K, V> Map<K, V> getRenderingCache(final RenderCacheStore<K, V> store) { checkThread(); Map<K, V> cacheStore = (Map<K, V>) renderingCache.get(store.getName()); if (cacheStore == null) { renderingCache.put(store.getName(), (Map<Object, Object>) (cacheStore = new HashMap<K, V>())); } return cacheStore; }
@SuppressWarnings("unchecked") public <K, V> Map<K, V> getRenderingCache(final RenderCacheStore<K, V> store) { checkThread(); Map<K, V> cacheStore = (Map<K, V>) renderingCache.get(store.getName()); if (cacheStore == null) { renderingCache.put(store.getName(), (Map<Object, Object>) (cacheStore = new HashMap<K, V>())); } return cacheStore; }
/** * Mark a class "literalizable". Meaning that all classes that are assignable to this type, are candidates for * reification to code snapshots for this context and all subcontexts. See {@link SnapshotMaker} for further details. * * @param clazz * the class, interface or superclass to be considered literalizable. */ public void addLiteralizableClass(final Class<?> clazz) { checkThread(); addLiteralizableClass(MetaClassFactory.get(clazz)); }
/** * Mark a class "literalizable". Meaning that all classes that are assignable to this type, are candidates for * reification to code snapshots for this context and all subcontexts. See {@link SnapshotMaker} for further details. * * @param clazz * the class, interface or superclass to be considered literalizable. */ public void addLiteralizableClass(final Class<?> clazz) { checkThread(); addLiteralizableClass(MetaClassFactory.get(clazz)); }