Java Code Examples for org.jboss.forge.furnace.proxy.Proxies#isForgeProxy()

The following examples show how to use org.jboss.forge.furnace.proxy.Proxies#isForgeProxy() . 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: AbstractRuleProvider.java    From windup with Eclipse Public License 1.0 6 votes vote down vote up
public AbstractRuleProvider()
{
    /*
     * In the case of a proxy, the no-args constructor will be called. This is the case even if the provider
     * itself would normally have a metadata param passed in.
     *
     * Once completed, the getMetadata() method will be proxied correctly, so this is ok. Just allow it to pass
     * in this case.
     */
    if (Proxies.isForgeProxy(this) && !Annotations.isAnnotationPresent(getClass(), RuleMetadata.class))
        return;

    if (!Annotations.isAnnotationPresent(getClass(), RuleMetadata.class))
    {
        throw new IllegalStateException(getClass().getName() + " must either "
                    + "be abstract, or specify @" + RuleMetadata.class.getName()
                    + ", or call a super() constructor and provide " + RuleProviderMetadata.class.getName());
    }
    this.metadata = MetadataBuilder.forProvider(getClass());
}
 
Example 2
Source File: CustomPrintStreamFactory.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
public void usePrintStream(PrintStream stream)
{
   if (stream == null)
      throw new IllegalArgumentException("Should have been a File");
   if (Proxies.isForgeProxy(stream))
      throw new IllegalArgumentException("Should not have been a proxy");
}
 
Example 3
Source File: ProfileManagerImpl.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setProfileListCallGet(List<Profile> profiles)
{
   Profile p = profiles.get(0);
   if (Proxies.isForgeProxy(p))
      throw new RuntimeException("[" + p + "] should not have been a proxy");
}
 
Example 4
Source File: JavaIOFactory.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
public void useFile(File file)
{
   if (file == null)
      throw new IllegalArgumentException("Should have been a File");
   if (!file.getClass().equals(File.class))
      throw new IllegalArgumentException("Should have been a File class");
   if (Proxies.isForgeProxy(file))
      throw new IllegalArgumentException("Should not have been a proxy");
}
 
Example 5
Source File: MockContextConsumer.java    From furnace with Eclipse Public License 1.0 5 votes vote down vote up
public void processContext(MockContext context)
{
   MockContextPayload payload = (MockContextPayload) context.getAttributes().get(
            MockContextPayload.class.getName());

   // this payload should not be proxied with the CLAC, since its interface is available in this classloader.
   if (Proxies.isForgeProxy(payload))
      throw new IllegalStateException("Should not have been a proxy");
}
 
Example 6
Source File: ClassWithClassAsParameter.java    From furnace with Eclipse Public License 1.0 4 votes vote down vote up
public boolean isProxyObject(Object enhancedValue)
{
   return Proxies.isForgeProxy(enhancedValue);
}
 
Example 7
Source File: ClassWithGetterAndSetter.java    From furnace with Eclipse Public License 1.0 4 votes vote down vote up
public boolean assertPassthroughNotProxied()
{
   return Proxies.isForgeProxy(passthrough);
}