Tabnine Logo
PropertyDescriptor
Code IndexAdd Tabnine to your IDE (free)

How to use
PropertyDescriptor
in
de.smartics.properties.api.core.domain

Best Java code snippets using de.smartics.properties.api.core.domain.PropertyDescriptor (Showing top 20 results out of 315)

origin: de.smartics.properties/smartics-properties-core

private static ListValueConstraint fetchListValueConstraint(
  final PropertyDescriptor descriptor) throws IllegalArgumentException
{
 for (final PropertyConstraint<?> constraint : descriptor.getConstraints())
 {
  if (ListValueConstraint.class == constraint.getClass())
  {
   return (ListValueConstraint) constraint;
  }
 }
 throw new IllegalArgumentException(
   "Property list value descriptor lacks list constraint.");
}
origin: de.smartics.properties/smartics-properties-config

/**
 * Returns the hash code of the object.
 *
 * @return the hash code.
 * @see de.smartics.properties.api.config.domain.PropertyDefinition#hashCode()
 */
@Override
public int hashCode()
{
 return descriptor.getKey().hashCode();
}
origin: de.smartics.properties/smartics-properties-config

private static String getExpression(final PropertyDescriptor descriptor)
{
 final PropertyExpression expression = descriptor.getDefaultExpression();
 return expression != null ? expression.getExpression() : null;
}
origin: de.smartics.properties/smartics-properties-report

/**
 * Returns the unique title of the report within the space.
 *
 * @return the unique title of the report within the space.
 */
public String getTitle()
{
 final String metadataValue = descriptor.getDocumentMetaData().getTitle();
 if (StringUtils.isBlank(metadataValue))
 {
  return descriptor.getKey().toString();
 }
 return metadataValue;
}
origin: de.smartics.properties/smartics-properties-report

/**
 * Returns the name that uniquely identifies the property report within the
 * report set.
 *
 * @return the name that uniquely identifies the property report within the
 *         report set.
 */
public String getLocalName()
{
 final String metadataValue = descriptor.getDocumentMetaData().getName();
 if (StringUtils.isBlank(metadataValue))
 {
  return descriptor.getDocumentName().getName();
 }
 return metadataValue;
}
origin: de.smartics.properties/smartics-properties-core

private void addDescriptor(final Class<?> propertySetType,
  final PropertyDescriptor descriptor,
  final List<DuplicatePropertyDeclarationException> exceptions)
{
 final String key = descriptor.getKey().toString();
 writeLock.lock();
 try
 {
  final PropertyDescriptor currentDescriptor = descriptorMap.get(key);
  if (currentDescriptor != null
    && currentDescriptor.getDeclaringType() != descriptor
      .getDeclaringType())
  {
   exceptions.add(new DuplicatePropertyDeclarationException(
     new PropertyDescriptorClashingMessageBean(
       PropertyCode.DUPLICATE_DECLARATION, currentDescriptor,
       descriptor)));
  }
  descriptors.put(propertySetType, descriptor);
  descriptorMap.put(key, descriptor);
  if (descriptor.isMandatory())
  {
   mandatoryProperties.add(descriptor);
  }
 }
 finally
 {
  writeLock.unlock();
 }
}
origin: de.smartics.properties/smartics-properties-report

if (descriptor != null)
 final PropertyKey key = descriptor.getKey();
 addElement(rootElement, "name", key);
 final PropertyType type = descriptor.getType();
 addElement(rootElement, "type", type.toString()); // NOPMD
 final UseType useType = descriptor.getUseType();
 addElement(rootElement, "useType", useType);
 addCategories(descriptor);
   descriptor.getDefaultExpression().getExpression();
 if (expression != null)
origin: de.smartics.properties/smartics-properties-config

if (plainValue == null && defaultValue == null && descriptor.isMandatory()
  && !isInAdminMode())
     descriptor.getConstraints(), plainValue);
 throw new PropertyValidationException(message);
origin: de.smartics.properties/smartics-properties-report

@Override
public void handle(final PropertyReportItem item) throws ReportException
{
 super.handle(item);
 final PropertyDescriptor descriptor = item.getDescriptor();
 final String key = descriptor.getKey().toString();
 final PropertyExpression expression = descriptor.getDefaultExpression();
 final String value =
   expression != null && expression.getExpression() != null ? expression
     .getExpression() : "";
 currentProperties.setProperty(key, value);
}
origin: de.smartics.properties/smartics-properties-config

if (currentValue == null)
 currentValue = descriptor.getDefaultExpression();
 if (currentValue == null)
if (descriptor.isSecured() && currentValue instanceof String)
origin: de.smartics.properties/smartics-properties-core

/**
 * Default constructor.
 *
 * @param descriptor the list descriptor to analyze.
 * @throws NullArgumentException if {@code descriptor} is <code>null</code>.
 * @throws IllegalArgumentException if the descriptor does not describe a list
 *           property or lacks the required {@link ListValueConstraint}.
 */
public ListPropertyHelper(final PropertyDescriptor descriptor)
 throws NullArgumentException, IllegalArgumentException
{
 this.descriptor = Arg.checkNotNull("descriptor", descriptor);
 final Class<?> propertyType = descriptor.getType().getType();
 if (!List.class.isAssignableFrom(propertyType))
 {
  throw new IllegalArgumentException(
    "The descriptor suppossed to describe a list property"
      + " actually describes a property of type '" + propertyType
      + "'.");
 }
 listValueConstraint = fetchListValueConstraint(descriptor);
}
origin: de.smartics.properties/smartics-properties-report

private void addRanges(final PropertyDescriptor descriptor)
{
 final PropertyValueRange<?> range = descriptor.getValueRange();
 if (range != null)
 {
  final Element valueRangeElement = new Element("valueRange", ns);
  final PropertyValueComment valueComment = reportItem.getValueComment();
  if (valueComment == null)
  {
   return;
  }
  final String summary =
    htmlUtils.cleanHtmlAndJavadoc(valueComment.getSummary());
  addElement(valueRangeElement, "summary", summary);
  final List<?> values = range.getValues();
  for (final Object value : values)
  {
   final String description =
     htmlUtils.cleanHtmlAndJavadoc(valueComment.getValueComment(value));
   final Element element = new Element("element", ns);
   addElement(element, "value", value);
   addElement(element, "description", description);
   valueRangeElement.addContent(element);
  }
  rootElement.addContent(valueRangeElement);
 }
}
origin: de.smartics.properties/smartics-properties-core

private static String resolve(final PropertyDescriptor descriptor)
{
 final DocumentName name = descriptor.getDocumentName();
 final String target = name.getName();
 // final String target = descriptor.getKey().toString();
 return target;
}
origin: de.smartics.properties/smartics-properties-core

/**
 * Returns the properties context for the given descriptor.
 *
 * @param descriptor the descriptor whose properties context is requested.
 * @return the context for the property provided by the descriptor. May return
 *         <code>null</code> if the {@code descriptor} is unknown.
 * @throws NullPointerException if {@code descriptor} is <code>null</code>.
 */
@CheckForNull
public PropertiesContext get(final PropertyDescriptor descriptor)
 throws NullPointerException
{
 Arg.checkNotNull("descriptor", descriptor);
 final Class<?> declaringType = descriptor.getDeclaringType();
 return get(declaringType);
}
origin: de.smartics.properties/smartics-properties-report

private void addCategories(final PropertyDescriptor descriptor)
{
 final PropertyCategories categories = descriptor.getCategories();
 final Element categoriesElement = new Element("propertyCategories", ns);
 for (final Class<?> category : categories.getCategories())
 {
  final String categoryType = category.getName();
  addElement(categoriesElement, "propertyCategory", categoryType);
 }
 rootElement.addContent(categoriesElement);
}
origin: de.smartics.properties/smartics-properties-config

if (plainValue == null && defaultValue == null && descriptor.isMandatory())
     descriptor.getConstraints(), plainValue);
 throw new PropertyValidationException(message);
origin: de.smartics.properties/smartics-properties-report

private PropertyValueComment loadValueComment(final PropertyReport report,
  final PropertyDescriptor descriptor)
{
 final Class<?> type = descriptor.getType().getType();
 if (type.isEnum()) // TODO: Constant class?
 {
  final String typeName = type.getName();
  final JavaClass javaClass = javaProjectBuilder.getClassByName(typeName);
  if (javaClass != null)
  {
   return loadValueComment(report, javaClass);
  }
  else
  {
   report.addProblem(new ReportProblem("Cannot find type class '"
                     + typeName + "'."));
  }
 }
 return new PropertyValueComment(null);
}
origin: de.smartics.properties/smartics-properties-core

/**
 * Usually the type is the type of the property of the descriptor. Only in the
 * case of a list, the type is the type of the list members.
 */
static void ensureConverter(final PropertyDescriptor descriptor,
  final Class<?> type)
{
 final Converter converter = ConvertUtils.lookup(type);
 if (converter != null)
 {
  return;
 }
 final PropertyValueRange<?> range = descriptor.getValueRange();
 if (range != null)
 {
  ConvertUtils.register(new PropertyValueRangeConverter(range, type), type);
 }
 else
 {
  ConvertUtils.register(new FromStringTypeConverter(type), type);
 }
}
origin: de.smartics.properties/smartics-properties-core

final ClassLoader loader = descriptor.getDeclaringType().getClassLoader(); // NOPMD
origin: de.smartics.properties/smartics-properties-config

private void checkValidPair(final PropertyDescriptor descriptor,
  final Property property) throws IllegalArgumentException
{
 final String name = property.getName();
 final String descriptorName = descriptor.getKey().toString();
 if (!name.equals(descriptorName))
 {
  throw new IllegalArgumentException("Property value with key '" + name
                    + "' does not match the key '"
                    + descriptorName
                    + "' in the property descriptor.");
 }
}
de.smartics.properties.api.core.domainPropertyDescriptor

Javadoc

Defines property meta data. This information excludes the actual property value. It provides information such as name, type, default values and constraints on the property value.

Most used methods

  • getConstraints
    Returns a list of constraints a value for the property has to meet.
  • getKey
    Returns the key of the property. This value must not be null.
  • getDefaultExpression
    Returns the expression to use to construct the value of the property. An expression may reference an
  • getDocumentName
    Returns the name of the document that identifies the document uniquely within the context of the pro
  • getType
    Returns the type of the property value. This value must not be null. If there is no value range sp
  • getValueRange
    Returns the range of values allowed for this property. The returned value may be null if there is no
  • isMandatory
    Checks if the property is mandatory to be not null. If the property is not mandatory, it is optional
  • getCategories
    Returns the categories this property is associated with.
  • getDeclaringType
    Returns the type that declares the property that is described by this instance.
  • getDocumentMetaData
    Returns the meta data information for the property. This value must not be null.
  • getUpdateIntervalInMs
    Returns the update interval in milliseconds (ms). An application may cache the value of the property
  • getUseType
    Returns the use type of the property.
  • getUpdateIntervalInMs,
  • getUseType,
  • isRuntimeMutable,
  • isSecured

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now