Node.CookieInstanceCookie.Ofpublic interface InstanceCookie extends Node.Cookie
| Modifier and Type | Interface | Description |
|---|---|---|
static interface |
InstanceCookie.Of |
Enhanced cookie that can answer queries about the type of the
instance it creates.
|
| Modifier and Type | Method | Description |
|---|---|---|
java.lang.Class<?> |
instanceClass() |
The type that the instance is expected to be assignable to.
|
java.lang.Object |
instanceCreate() |
Create or obtain an instance.
|
java.lang.String |
instanceName() |
The name of
instanceClass(). |
java.lang.String instanceName()
instanceClass().
Should be the same as instanceClass().getName()
but may be able to avoid actually loading the class.
Generally this method should not be used.
java.lang.Class<?> instanceClass()
throws java.io.IOException,
java.lang.ClassNotFoundException
Generally this method should not be used.
To test whether the instance will be assignable to some type,
use InstanceCookie.Of.instanceOf(java.lang.Class<?>) instead.
To actually load instances, use instanceCreate(); if your
objects are not naturally singletons (e.g. public no-argument constructor),
the instances should rather be of some kind of factory you define.
java.io.IOException - if metadata about the instance could not be read, etc.java.lang.ClassNotFoundException - if the instance type could not be loadedjava.lang.Object instanceCreate()
throws java.io.IOException,
java.lang.ClassNotFoundException
InstanceCookie) caches
previously returned instances.instanceClass()java.io.IOException - for the same reasons as instanceClass(), or an object could not be deserialized, etc.java.lang.ClassNotFoundException - for the same reasons as instanceClass()Built on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.