com.cisco.oss.foundation.logging.structured
Class AbstractFoundationLoggingMarker.JavaClassObject

java.lang.Object
  extended by javax.tools.SimpleJavaFileObject
      extended by com.cisco.oss.foundation.logging.structured.AbstractFoundationLoggingMarker.JavaClassObject
All Implemented Interfaces:
FileObject, JavaFileObject
Enclosing class:
AbstractFoundationLoggingMarker

public static class AbstractFoundationLoggingMarker.JavaClassObject
extends SimpleJavaFileObject


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.tools.JavaFileObject
JavaFileObject.Kind
 
Field Summary
protected  ByteArrayOutputStream bos
          Byte code created by the compiler will be stored in this ByteArrayOutputStream so that we can later get the byte array out of it and put it in the memory as an instance of our class.
 
Fields inherited from class javax.tools.SimpleJavaFileObject
kind, uri
 
Constructor Summary
AbstractFoundationLoggingMarker.JavaClassObject(String name, JavaFileObject.Kind kind)
          Registers the compiled class object under URI containing the class full name
 
Method Summary
 byte[] getBytes()
          Will be used by our file manager to get the byte code that can be put into memory to instantiate our class
 OutputStream openOutputStream()
          Will provide the compiler with an output stream that leads to our byte array.
 
Methods inherited from class javax.tools.SimpleJavaFileObject
delete, getAccessLevel, getCharContent, getKind, getLastModified, getName, getNestingKind, isNameCompatible, openInputStream, openReader, openWriter, toString, toUri
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bos

protected final ByteArrayOutputStream bos
Byte code created by the compiler will be stored in this ByteArrayOutputStream so that we can later get the byte array out of it and put it in the memory as an instance of our class.

Constructor Detail

AbstractFoundationLoggingMarker.JavaClassObject

public AbstractFoundationLoggingMarker.JavaClassObject(String name,
                                                       JavaFileObject.Kind kind)
Registers the compiled class object under URI containing the class full name

Parameters:
name - Full name of the compiled class
kind - Kind of the data. It will be CLASS in our case
Method Detail

getBytes

public byte[] getBytes()
Will be used by our file manager to get the byte code that can be put into memory to instantiate our class

Returns:
compiled byte code

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
Will provide the compiler with an output stream that leads to our byte array. This way the compiler will write everything into the byte array that we will instantiate later

Specified by:
openOutputStream in interface FileObject
Overrides:
openOutputStream in class SimpleJavaFileObject
Throws:
IOException


Copyright © 2014 Cisco. All Rights Reserved.