/** * @param derivdedIdentifier A value returned from {@link #derivedIdentifier(String)}. * @return The derivedIdentifier with package parts shortened to initials. */ public static String shortenDerivedIdentifier(final String derivdedIdentifier) { return shortenDerivedIdentifier(derivdedIdentifier, "_"); }
public static MetaClassCache getMetaClassCache() { if (cache == null) { cache = CacheUtil.getCache(MetaClassCache.class); } return cache; }
private static String generateMarshallerImplClassName(final MetaClass type, final boolean gwtTarget) { final String varName = getVarName(type); if (VERY_SHORT_MARSHALLER_NAMES && !gwtTarget) { return VERY_SHORT_MARSHALLER_PREFIX + uniqueGenerator.uniqueName(NameUtil.getShortHashString(varName)); } else if (SHORT_MARSHALLER_NAMES) { return SHORT_MARSHALLER_PREFIX + uniqueGenerator.uniqueName(NameUtil.shortenDerivedIdentifier(varName)) + "_Impl"; } else { return MARSHALLER_NAME_PREFIX + varName + "_Impl"; } }
/** * @return A compact String representation of the given object's hashCode, using only characters in the ranges * 'A'-'Z', 'a'-'z', '0'-'9', '_', and '$'. */ public static String getShortHashString(final Object obj) { return getShortHashString(obj.hashCode()); }
public static synchronized void clearAll() { log.info("clearing all generation caches..."); for (Map.Entry<Class<? extends CacheStore>, CacheStore> entry : CACHE_STORE_MAP.entrySet()) { synchronized (entry.getKey()) { entry.getValue().clear(); } } } }
public static MetaClassCache getMetaClassCache() { if (cache == null) { cache = CacheUtil.getCache(MetaClassCache.class); } return cache; }
private static String generateMarshallerImplClassName(final MetaClass type, final boolean gwtTarget) { final String varName = getVarName(type); if (VERY_SHORT_MARSHALLER_NAMES && !gwtTarget) { return VERY_SHORT_MARSHALLER_PREFIX + uniqueGenerator.uniqueName(NameUtil.getShortHashString(varName)); } else if (SHORT_MARSHALLER_NAMES) { return SHORT_MARSHALLER_PREFIX + uniqueGenerator.uniqueName(NameUtil.shortenDerivedIdentifier(varName)) + "_Impl"; } else { return MARSHALLER_NAME_PREFIX + varName + "_Impl"; } }
/** * @param derivdedIdentifier A value returned from {@link #derivedIdentifier(String)}. * @return The derivedIdentifier with package parts shortened to initials. */ public static String shortenDerivedIdentifier(final String derivdedIdentifier) { return shortenDerivedIdentifier(derivdedIdentifier, "_"); }
/** * @return A compact String representation of the given object's hashCode, using only characters in the ranges * 'A'-'Z', 'a'-'z', '0'-'9', '_', and '$'. */ public static String getShortHashString(final Object obj) { return getShortHashString(obj.hashCode()); }
public static synchronized void clearAll() { log.info("clearing all generation caches..."); for (Map.Entry<Class<? extends CacheStore>, CacheStore> entry : CACHE_STORE_MAP.entrySet()) { synchronized (entry.getKey()) { entry.getValue().clear(); } } } }
/** * @return an instance of {@link EnvironmentConfig}. Do NOT retain a reference to this value. Call every time * you need additional configuration information. */ public static EnvironmentConfig getEnvironmentConfig() { return CacheUtil.getCache(EnvironmentConfigCache.class).get(); }
/** * @return an instance of {@link EnvironmentConfig}. Do NOT retain a reference to this value. Call every time * you need additional configuration information. */ public static EnvironmentConfig getEnvironmentConfig() { return CacheUtil.getCache(EnvironmentConfigCache.class).get(); }
public static void clearCache() { CacheUtil.getCache(EnvironmentConfigCache.class).clear(); }
public static void clearCache() { CacheUtil.getCache(EnvironmentConfigCache.class).clear(); }
public String getHashForTypesAnnotatedWith(final String seed, final Class<? extends Annotation> annotation) { if (!CacheUtil.getCache(CacheHolder.class).ANNOTATIONS_TO_CLASS.containsKey(annotation.getName())) { return "0"; } else { try { final MessageDigest md = MessageDigest.getInstance("SHA-256"); if (seed != null) { md.update(seed.getBytes()); } final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); for (final SortableClassFileWrapper classFileWrapper : CacheUtil .getCache(CacheHolder.class).ANNOTATIONS_TO_CLASS.get(annotation.getName())) { byteArrayOutputStream.reset(); final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); classFileWrapper.getClassFile().write(dataOutputStream); dataOutputStream.flush(); md.update(byteArrayOutputStream.toByteArray()); } return RebindUtils.hashToHexString(md.digest()); } catch (final Exception e) { throw new RuntimeException("could not generate hash", e); } } }
public String getHashForTypesAnnotatedWith(final String seed, final Class<? extends Annotation> annotation) { if (!CacheUtil.getCache(CacheHolder.class).ANNOTATIONS_TO_CLASS.containsKey(annotation.getName())) { return "0"; } else { try { final MessageDigest md = MessageDigest.getInstance("SHA-256"); if (seed != null) { md.update(seed.getBytes()); } final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); for (final SortableClassFileWrapper classFileWrapper : CacheUtil .getCache(CacheHolder.class).ANNOTATIONS_TO_CLASS.get(annotation.getName())) { byteArrayOutputStream.reset(); final DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); classFileWrapper.getClassFile().write(dataOutputStream); dataOutputStream.flush(); md.update(byteArrayOutputStream.toByteArray()); } return RebindUtils.hashToHexString(md.digest()); } catch (final Exception e) { throw new RuntimeException("could not generate hash", e); } } }
@BeforeClass public static void setup() { CacheUtil.getCache(EnvironmentConfigCache.class).addPermanentFrameworkProperty("errai.ioc.async_bean_manager", "true"); }
@AfterClass public static void tearDown() { CacheUtil.getCache(EnvironmentConfigCache.class).addPermanentFrameworkProperty("errai.ioc.async_bean_manager", "false"); }