Permalink
Browse files

Javadocs

  • Loading branch information...
1 parent 1a447eb commit d6dc0c9dfdbb69ef023b75323c70ed32af32fac6 @eskatos eskatos committed Feb 15, 2013
Showing with 167 additions and 43 deletions.
  1. +21 −0 core/api/src/main/java/org/qi4j/api/activation/ActivationException.java
  2. +4 −1 core/api/src/main/java/org/qi4j/api/association/GenericAssociationInfo.java
  3. +1 −1 core/api/src/main/java/org/qi4j/api/composite/ConstructorDescriptor.java
  4. +1 −1 core/api/src/main/java/org/qi4j/api/composite/PropertyMapper.java
  5. +38 −9 core/api/src/main/java/org/qi4j/api/entity/EntityReference.java
  6. +1 −1 core/api/src/main/java/org/qi4j/api/mixin/MixinDescriptor.java
  7. +3 −0 core/api/src/main/java/org/qi4j/api/property/InvalidPropertyTypeException.java
  8. +4 −4 core/api/src/main/java/org/qi4j/api/property/Numbers.java
  9. +12 −0 core/api/src/main/java/org/qi4j/api/service/ServiceReference.java
  10. +1 −1 core/api/src/main/java/org/qi4j/api/sideeffect/SideEffectDescriptor.java
  11. +9 −1 core/api/src/main/java/org/qi4j/api/structure/ApplicationDescriptor.java
  12. +3 −0 core/api/src/main/java/org/qi4j/api/structure/Layer.java
  13. +7 −1 core/api/src/main/java/org/qi4j/api/structure/LayerDescriptor.java
  14. +23 −1 core/api/src/main/java/org/qi4j/api/structure/Module.java
  15. +2 −1 core/api/src/main/java/org/qi4j/api/type/CollectionType.java
  16. +1 −1 core/api/src/main/java/org/qi4j/api/type/EnumType.java
  17. +2 −1 core/api/src/main/java/org/qi4j/api/type/MapType.java
  18. +1 −1 core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
  19. +3 −2 core/api/src/main/java/org/qi4j/api/type/ValueType.java
  20. +6 −3 core/api/src/main/java/org/qi4j/api/unitofwork/UnitOfWorkException.java
  21. +3 −0 core/api/src/main/java/org/qi4j/api/util/Classes.java
  22. +8 −0 core/api/src/main/java/org/qi4j/api/util/Dates.java
  23. +4 −4 core/runtime/src/main/java/org/qi4j/runtime/composite/AbstractModifierModel.java
  24. +3 −3 core/runtime/src/main/java/org/qi4j/runtime/composite/ConstructorModel.java
  25. +5 −5 core/runtime/src/main/java/org/qi4j/runtime/composite/MixinModel.java
  26. +1 −1 core/runtime/src/main/java/org/qi4j/runtime/composite/SideEffectModel.java
@@ -1,7 +1,28 @@
+/*
+ * Copyright 2013 Niclas Hedhman.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.qi4j.api.activation;
+/**
+ * Thrown when unable to activate.
+ */
public class ActivationException extends Exception
{
+ private static final long serialVersionUID = 1L;
public ActivationException( String message, Throwable cause )
{
super( message, cause );
@@ -13,7 +13,7 @@
* implied.
*
* See the License for the specific language governing permissions and
- * limitations under the License.
+ * limitations under the License.
*/
package org.qi4j.api.association;
@@ -23,6 +23,9 @@
import static org.qi4j.api.util.Classes.typeOf;
+/**
+ * Generic Association info.
+ */
public final class GenericAssociationInfo
{
public static Type associationTypeOf( AccessibleObject accessor )
@@ -21,5 +21,5 @@
*/
public interface ConstructorDescriptor
{
- Constructor constructor();
+ Constructor<?> constructor();
}
@@ -26,7 +26,7 @@
import org.qi4j.api.value.ValueComposite;
/**
- * Transfer properties to Composite properties
+ * Transfer java.util.Properties to Composite properties
*/
public final class PropertyMapper
{
@@ -18,51 +18,77 @@
import org.qi4j.api.util.NullArgumentException;
/**
- * An EntityReference is identity of a specific
- * Entity instance. When stringified, the identity is used as-is. Example:
- * <pre>
- * 123456-abcde
- * </pre>
+ * An EntityReference is identity of a specific Entity instance.
+ * <p>When stringified, the identity is used as-is. Example:</p>
+ * <pre>123456-abcde</pre>
*/
public final class EntityReference
implements Serializable
{
+ /**
+ * Parse an URI to an EntityReference.
+ * @param uri the URI to parse
+ * @return the EntityReference represented by the given URI
+ */
public static EntityReference parseURI( String uri )
{
String identity = uri.substring( "urn:qi4j:entity:".length() );
return new EntityReference( identity );
}
- public static EntityReference parseEntityReference( String id )
+ /**
+ * Parse an Entity identity to an EntityReference.
+ * @param identity the EntityReference identity
+ * @return the EntityReference represented by the given identity
+ */
+ public static EntityReference parseEntityReference( String identity )
{
- return new EntityReference( id );
+ return new EntityReference( identity );
}
- public static EntityReference entityReferenceFor( Object o )
+ /**
+ * @param object an EntityComposite
+ * @return the EntityReference for the given EntityComposite
+ */
+ public static EntityReference entityReferenceFor( Object object )
{
- return new EntityReference( (EntityComposite) o );
+ return new EntityReference( (EntityComposite) object );
}
private static final long serialVersionUID = 1L;
private String identity;
+ /**
+ * @param entityComposite a non-null EntityComposite
+ * @throws NullPointerException if entityComposite is null
+ */
public EntityReference( EntityComposite entityComposite )
{
this( entityComposite.identity().get() );
}
+ /**
+ * @param identity reference identity
+ * @throws NullArgumentException if identity is null or empty
+ */
public EntityReference( String identity )
{
NullArgumentException.validateNotEmpty( "identity", identity );
this.identity = identity;
}
+ /**
+ * @return This EntityReference identity.
+ */
public final String identity()
{
return identity;
}
+ /**
+ * @return An URI representation of this EntityReference.
+ */
public String toURI()
{
return "urn:qi4j:entity:" + identity;
@@ -91,6 +117,9 @@ public int hashCode()
return result;
}
+ /**
+ * @return This EntityReference identity.
+ */
@Override
public String toString()
{
@@ -19,5 +19,5 @@
*/
public interface MixinDescriptor
{
- Class mixinClass();
+ Class<?> mixinClass();
}
@@ -3,6 +3,9 @@
import java.lang.reflect.AccessibleObject;
import org.qi4j.api.common.ConstructionException;
+/**
+ * Thrown when attempting to subclass Property.
+ */
public class InvalidPropertyTypeException extends ConstructionException
{
public InvalidPropertyTypeException( AccessibleObject accessor )
@@ -17,10 +17,10 @@
import java.math.BigDecimal;
/**
- * Convenience class for mathematical operations on
- * numerical properties.
- * <p/>
- * add(object.number(), 5)
+ * Convenience class for mathematical operations on numerical properties.
+ * <pre>import static org.qi4j.api.property.Numbers.*;
+ * ...
+ * add( object.numberProperty(), 5 );</pre>
*/
public final class Numbers
{
@@ -25,11 +25,23 @@
public interface ServiceReference<T>
extends HasTypes, ActivationEventListenerRegistration, MetaInfoHolder
{
+ /**
+ * @return the service's identity
+ */
String identity();
+ /**
+ * @return the actual service
+ */
T get();
+ /**
+ * @return TRUE if the service is active, otherwise return FALSE
+ */
boolean isActive();
+ /**
+ * @return TRUE if the service is available, otherwise return FALSE
+ */
boolean isAvailable();
}
@@ -19,5 +19,5 @@
*/
public interface SideEffectDescriptor
{
- Class modifierClass();
+ Class<?> modifierClass();
}
@@ -11,7 +11,6 @@
* limitations under the License.
*
*/
-
package org.qi4j.api.structure;
import org.qi4j.api.Qi4j;
@@ -23,7 +22,16 @@
public interface ApplicationDescriptor
extends VisitableHierarchy<Object, Object>
{
+ /**
+ * Create a new instance of the Application.
+ * @param runtime Qi4j Runtime
+ * @param importedServiceInstances Imported Services instances
+ * @return a new instance of the Application.
+ */
Application newInstance( Qi4j runtime, Object... importedServiceInstances );
+ /**
+ * @return the Application's name
+ */
String name();
}
@@ -24,5 +24,8 @@
public interface Layer
extends ActivationEventListenerRegistration, Activation, MetaInfoHolder
{
+ /**
+ * @return the Layer's name
+ */
String name();
}
@@ -11,15 +11,21 @@
* limitations under the License.
*
*/
-
package org.qi4j.api.structure;
/**
* Layer Descriptor.
*/
public interface LayerDescriptor
{
+
+ /**
+ * @return the Layer's name
+ */
String name();
+ /**
+ * @return Layers used by this Layer
+ */
UsedLayersDescriptor usedLayers();
}
@@ -12,7 +12,6 @@
* limitations under the License.
*
*/
-
package org.qi4j.api.structure;
import org.qi4j.api.activation.ActivationEventListenerRegistration;
@@ -43,15 +42,38 @@
QueryBuilderFactory,
ServiceFinder
{
+
+ /**
+ * @return the Module's name
+ */
String name();
+ /**
+ * @return the Module's ClassLoader
+ */
ClassLoader classLoader();
+ /**
+ * @param typeName name of a transient composite type
+ * @return the descriptor for a transient composite or null if the class could not be found or the transient composite is not visible
+ */
TransientDescriptor transientDescriptor( String typeName );
+ /**
+ * @param typeName name of an entity composite type
+ * @return the descriptor for an entity composite or null if the class could not be found or the entity composite is not visible
+ */
EntityDescriptor entityDescriptor( String typeName );
+ /**
+ * @param typeName name of an object type
+ * @return the descriptor for an object or null if the class could not be found or the object is not visible
+ */
ObjectDescriptor objectDescriptor( String typeName );
+ /**
+ * @param typeName name of a value composite type
+ * @return the descriptor for a value composite or null if the class could not be found or the value composite is not visible
+ */
ValueDescriptor valueDescriptor( String typeName );
}
@@ -20,7 +20,8 @@
import org.qi4j.api.util.Classes;
/**
- * Collection type. This handles Collection, List and Set types
+ * Collection ValueType.
+ * <p>This handles Collection, List and Set types.</p>
*/
public final class CollectionType
extends ValueType
@@ -16,7 +16,7 @@
import java.lang.reflect.Type;
/**
- * Enumeration type
+ * Enum ValueType.
*/
public final class EnumType
extends ValueType
@@ -18,7 +18,8 @@
import org.qi4j.api.util.Classes;
/**
- * Map type. This handles instances of Map
+ * Map ValueType.
+ * <p>This handles instances of Map.</p>
*/
public final class MapType
extends ValueType
@@ -22,7 +22,7 @@
import org.qi4j.api.value.ValueDescriptor;
/**
- * ValueComposite type
+ * ValueComposite ValueType.
*/
public final class ValueCompositeType
extends ValueType
@@ -23,8 +23,6 @@
/**
* Base class for types of values in ValueComposites and Properties.
- *
- * TODO I think the ValueType system requires some major re-thinking.
*/
public class ValueType
implements HasTypes
@@ -92,6 +90,9 @@ public static boolean isPrimitiveValueType( ValueType valueType )
return isPrimitiveValueType( valueType.mainType() );
}
+ /**
+ * @see ValueType#isPrimitiveValue(java.lang.Object)
+ */
public static boolean isPrimitiveValueType( Class<?> type )
{
NullArgumentException.validateNotNull( "type", type );
Oops, something went wrong.

0 comments on commit d6dc0c9

Please sign in to comment.