Skip to content

Commit

Permalink
Update P, In, Out, etc. annotations to have default weight value.
Browse files Browse the repository at this point in the history
  • Loading branch information
neilcsmith-net committed Oct 25, 2023
1 parent 52b39b9 commit f2a12b1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,7 +19,6 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/

package org.praxislive.code.userapi;

import java.lang.annotation.ElementType;
Expand All @@ -28,22 +27,20 @@
import java.lang.annotation.Target;

/**
* Annotate a field or method representing an auxiliary input, such as an {@link Input}
* or a method with single parameter. A port will be created on the component.
* Auxiliary inputs show after inputs, outputs, properties and triggers.
* <p>
* The value gives the relative position compared to other @AuxIn elements.
* Values must be unique. They do not have to be contiguous.
* Annotate a field or method representing an auxiliary input, such as an
* {@link Input} or a method with single parameter. A port will be created on
* the component.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface AuxIn {

/**
* Relative position compared to other @AuxIn elements. Values must be unique.
* They do not have to be contiguous.
*
* @return position
* Relative weight compared to other @AuxIn elements. Elements will be
* sorted by weight, and then alphabetically. Higher weight elements will
* sort after lower weight elements.
*
* @return weight
*/
int value();
int value() default 0;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,7 +19,6 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/

package org.praxislive.code.userapi;

import java.lang.annotation.ElementType;
Expand All @@ -28,22 +27,20 @@
import java.lang.annotation.Target;

/**
* Annotate a field representing an auxiliary output, such as {@link Output}. A
* Annotate a field representing an auxiliary output, such as {@link Output}. A
* port will be created on the component. Auxiliary outputs show after inputs,
* outputs, properties, triggers and auxiliary inputs.
* <p>
* The value gives the relative position compared to other @AuxOut elements.
* Values must be unique. They do not have to be contiguous.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface AuxOut {

/**
* Relative position compared to other @AuxOut elements. Values must be unique.
* They do not have to be contiguous.
*
* @return
* Relative weight compared to other @AuxOut elements. Elements will be
* sorted by weight, and then alphabetically. Higher weight elements will
* sort after lower weight elements.
*
* @return weight
*/
int value();
int value() default 0;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2022 Neil C Smith.
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand Down Expand Up @@ -36,7 +36,8 @@

/**
* Relative weight compared to other @FN elements. Functions will be sorted
* by weight, and then alphabetically.
* by weight, and then alphabetically. Higher weight elements will sort
* after lower weight elements.
*
* @return weight
*/
Expand Down
20 changes: 9 additions & 11 deletions praxiscore-code/src/main/java/org/praxislive/code/userapi/In.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -27,22 +27,20 @@
import java.lang.annotation.Target;

/**
* Annotate a field or method representing an input, such as an {@link Input} or a method
* with single parameter. A port will be created on the component. Inputs show first on the
* component.
* <p>
* The value gives the relative position compared to other @In elements. Values
* must be unique. They do not have to be contiguous.
* Annotate a field or method representing an input, such as an {@link Input} or
* a method with single parameter. A port will be created on the component.
* Inputs show first on the component.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface In {

/**
* Relative position compared to other @In elements. Values must be unique.
* They do not have to be contiguous.
* Relative weight compared to other @In elements. Elements will be sorted
* by weight, and then alphabetically. Higher weight elements will sort
* after lower weight elements.
*
* @return position
* @return weight
*/
int value();
int value() default 0;
}
20 changes: 12 additions & 8 deletions praxiscore-code/src/main/java/org/praxislive/code/userapi/Out.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,7 +19,6 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/

package org.praxislive.code.userapi;

import java.lang.annotation.ElementType;
Expand All @@ -28,14 +27,19 @@
import java.lang.annotation.Target;

/**
* Annotate a field representing an output, such as {@link Output}. A port will be
* created on the component. Outputs show after inputs.
* <p>
* The value gives the relative position compared to other @Out elements.
* Values must be unique. They do not have to be contiguous.
* Annotate a field representing an output, such as {@link Output}. A port will
* be created on the component. Outputs show after inputs.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface Out {
int value();

/**
* Relative weight compared to other @Out elements. Elements will be sorted
* by weight, and then alphabetically. Higher weight elements will sort
* after lower weight elements.
*
* @return weight
*/
int value() default 0;
}
40 changes: 21 additions & 19 deletions praxiscore-code/src/main/java/org/praxislive/code/userapi/P.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2018 Neil C Smith.
* Copyright 2023 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3 only, as
Expand All @@ -19,7 +19,6 @@
* Please visit https://www.praxislive.org if you need additional information or
* have any questions.
*/

package org.praxislive.code.userapi;

import java.lang.annotation.ElementType;
Expand All @@ -28,36 +27,39 @@
import java.lang.annotation.Target;

/**
* Annotate a field as a property. A control and port will be automatically created
* so that values of the field can be queried or set from the UI or other components.
* Field values will also be stored in the project, and available when copying or
* exporting, unless the field is read-only or transient.
* Annotate a field as a property. A control and port will be automatically
* created so that values of the field can be queried or set from the UI or
* other components. Field values will also be stored in the project, and
* available when copying or exporting, unless the field is read-only or
* transient.
* <p>
* The @P annotation may be used on fields of type {@link Property},
* or any field type that can be backed by a Property - String, double, float, int, boolean,
* PArray, PBytes, any enum, any Serializable implementation, or a List of Serializable
* subclasses.
* The @P annotation may be used on fields of type {@link Property}, or any
* field type that can be backed by a Property, such as String, double, float,
* int, boolean, any Value type, any enum, etc.
* <p>
* The @P annotation can also be used on fields that represent a represent
* loadable resource, in which case the port / control will accept a URL and the
* field type will be the loaded resource. See specific custom code types for
* what resources they support loading.
* <p>
* Use the various {@link Type} annotations to set default values, allowed values, ranges, etc.
* Use {@link Port @Port} to suppress automatic creation of a port.
* Use {@link Transient @Transient} to stop the field value being saved as part of the project.
* Use {@link ReadOnly @ReadOnly} to stop the field being settable externally (it can
* still be set in code).
* Use the various {@link Type} annotations to set default values, allowed
* values, ranges, etc. Use {@link Config.Port @Config.Port(false)} to suppress
* automatic creation of a port. Use {@link Transient @Transient} to stop the
* field value being saved as part of the project. Use
* {@link ReadOnly @ReadOnly} to stop the field being settable externally (it
* can still be set in code).
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface P {

/**
* Relative position compared to other @P elements. Values must be unique.
* They do not have to be contiguous.
* Relative weight compared to other @P elements. Elements will be sorted by
* weight, and then alphabetically. Higher weight elements will sort after
* lower weight elements.
*
* @return position
* @return weight
*/
int value();
int value() default 0;

}

0 comments on commit f2a12b1

Please sign in to comment.