Java Code Examples for org.jboss.forge.furnace.proxy.Proxies#unwrapProxyClassName()
The following examples show how to use
org.jboss.forge.furnace.proxy.Proxies#unwrapProxyClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParserContext.java From windup with Eclipse Public License 1.0 | 6 votes |
/** * Initialize tag handlers based upon the provided furnace instance. */ public ParserContext(Furnace furnace, RuleLoaderContext ruleLoaderContext) { this.ruleLoaderContext = ruleLoaderContext; @SuppressWarnings("rawtypes") Imported<ElementHandler> loadedHandlers = furnace.getAddonRegistry().getServices(ElementHandler.class); for (ElementHandler<?> handler : loadedHandlers) { NamespaceElementHandler annotation = Annotations.getAnnotation(handler.getClass(), NamespaceElementHandler.class); if (annotation != null) { HandlerId handlerID = new HandlerId(annotation.namespace(), annotation.elementName()); if (handlers.containsKey(handlerID)) { String className1 = Proxies.unwrapProxyClassName(handlers.get(handlerID).getClass()); String className2 = Proxies.unwrapProxyClassName(handler.getClass()); throw new WindupException("Multiple handlers registered with id: " + handlerID + " Classes are: " + className1 + " and " + className2); } handlers.put(handlerID, handler); } } }
Example 2
Source File: ProxiesTest.java From furnace with Eclipse Public License 1.0 | 5 votes |
@Test public void testUnwrapProxyClassName() { Bean enhancedObj = Proxies.enhance(Bean.class, new ForgeProxy() { @Override public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return null; } @Override public Object getDelegate() { return null; } @Override public Object getHandler() throws Exception { return this; } }); Assert.assertNotEquals(Bean.class.getName(), enhancedObj.getClass().getName()); String result = Proxies.unwrapProxyClassName(enhancedObj.getClass()); Assert.assertEquals(Bean.class.getName(), result); }
Example 3
Source File: TagsIncludeExcludeTest.java From windup with Eclipse Public License 1.0 | 5 votes |
@Override public boolean beforeRuleEvaluation(GraphRewrite event, Rule rule, EvaluationContext context) { RuleProvider provider = (RuleProvider) ((Context) rule).get(RuleMetadataType.RULE_PROVIDER); String realName = Proxies.unwrapProxyClassName(provider.getClass()); executedRules.put(realName, Boolean.FALSE); return false; }
Example 4
Source File: TagsIncludeExcludeTest.java From windup with Eclipse Public License 1.0 | 5 votes |
@Override public void afterRuleConditionEvaluation(GraphRewrite event, EvaluationContext context, Rule rule, boolean result) { RuleProvider provider = (RuleProvider) ((Context) rule).get(RuleMetadataType.RULE_PROVIDER); String realName = Proxies.unwrapProxyClassName(provider.getClass()); executedRules.put(realName, Boolean.TRUE); }
Example 5
Source File: SkippingReportsRenderingTest.java From windup with Eclipse Public License 1.0 | 5 votes |
@Override public boolean beforeRuleEvaluation(GraphRewrite event, Rule rule, EvaluationContext context) { RuleProvider provider = (RuleProvider) ((Context) rule).get(RuleMetadataType.RULE_PROVIDER); String realName = Proxies.unwrapProxyClassName(provider.getClass()); executedRules.put(realName, Boolean.FALSE); return false; }
Example 6
Source File: SkippingReportsRenderingTest.java From windup with Eclipse Public License 1.0 | 5 votes |
@Override public void afterRuleConditionEvaluation(GraphRewrite event, EvaluationContext context, Rule rule, boolean result) { RuleProvider provider = (RuleProvider) ((Context) rule).get(RuleMetadataType.RULE_PROVIDER); String realName = Proxies.unwrapProxyClassName(provider.getClass()); executedRules.put(realName, Boolean.TRUE); }
Example 7
Source File: LabelLoaderImpl.java From windup with Eclipse Public License 1.0 | 5 votes |
/** * Multiple 'Labelsets' with the same ID are not allowed. See {@link LabelsetMetadata#getID()} * * @throws WindupException in case there are multiple 'Labelsets' using the same ID **/ private void checkForDuplicateProviders(List<LabelProvider> providers) { /* * LabelsetMetadata We are using a map so that we can easily pull out the previous value later (in the case of a duplicate) */ Map<LabelProvider, LabelProvider> duplicates = new HashMap<>(providers.size()); for (LabelProvider provider : providers) { LabelProvider previousProvider = duplicates.get(provider); if (previousProvider != null) { String typeMessage; String currentProviderOrigin = provider.getMetadata().getOrigin(); String previousProviderOrigin = previousProvider.getMetadata().getOrigin(); if (previousProvider.getClass().equals(provider.getClass())) { typeMessage = " (type: " + previousProviderOrigin + " and " + currentProviderOrigin + ")"; } else { typeMessage = " (types: " + Proxies.unwrapProxyClassName(previousProvider.getClass()) + " at " + previousProviderOrigin + " and " + Proxies.unwrapProxyClassName(provider.getClass()) + " at " + currentProviderOrigin + ")"; } throw new WindupException("Found two providers with the same id: " + provider.getMetadata().getID() + typeMessage); } duplicates.put(provider, provider); } }
Example 8
Source File: RuleLoaderImpl.java From windup with Eclipse Public License 1.0 | 5 votes |
private void checkForDuplicateProviders(List<RuleProvider> providers) { /* * We are using a map so that we can easily pull out the previous value later (in the case of a duplicate) */ Map<RuleProvider, RuleProvider> duplicates = new HashMap<>(providers.size()); for (RuleProvider provider : providers) { RuleProvider previousProvider = duplicates.get(provider); if (previousProvider != null) { String typeMessage; String currentProviderOrigin = provider.getMetadata().getOrigin(); String previousProviderOrigin = previousProvider.getMetadata().getOrigin(); if (previousProvider.getClass().equals(provider.getClass())) { typeMessage = " (type: " + previousProviderOrigin + " and " + currentProviderOrigin + ")"; } else { typeMessage = " (types: " + Proxies.unwrapProxyClassName(previousProvider.getClass()) + " at " + previousProviderOrigin + " and " + Proxies.unwrapProxyClassName(provider.getClass()) + " at " + currentProviderOrigin + ")"; } throw new WindupException("Found two providers with the same id: " + provider.getMetadata().getID() + typeMessage); } duplicates.put(provider, provider); } }